Contents tagged with F#
-
Time Flies Like An Arrow in F# and the Reactive Extensions for .NET
In the past week, I had the pleasure of speaking on Reactive Programming in F# with Brian McNamara at a conference out in Seattle. The point of this talk was to cover the what and why of using F# in reactive programming on both the client and the server and showed quite a few examples. One of the samples Brian alluded to, the “Time Flies Like An Arrow” example, which is an example of having a stream of text, each character delayed behind the previous, follow the mouse around the screen. Brian’s version used a combination of both the asynchronous workflows which are a standard part of F#, as well as first class events/observables. For my version, I’m going to strictly use F# first class events and the integration with the Reactive Extensions for .NET to show you how it can be done.
-
The F# PowerPack Released on CodePlex
As announced yesterday, the new February 2010 release of F# is out. For those using Visual Studio 2008 and Mono, you can pick up the download here. This release is much more of a stabilization release instead of adding a lot of features including improvements in tooling, the project system and so on.
-
Upcoming Release of F# 2.0
As you may have noticed with the recent release of the Visual Studio 2010 Release Candidate, that we are getting closer and closer to the first official release of the F# language. Shortly, there will be the standard zip/MSI file provided to those who are still running Visual Studio 2008 as well as Mono that I will post a link to when it becomes available. Dr. Brian McNamara of the F# team has a few goodies in his post here about the release here. Just as he asks for help with old blog posts that contain code that no longer works due to the language changes, I’ll ask the same of you all as well. If there are blog posts of mine out there that are seriously out of date, please do let me know.
-
F# and the Dynamic Lookup Operator ala C#
In the previous post, we covered various scenarios around how we’d make the syntax around using the MongoDB C# Driver a little nicer and less stringy. And before that we looked at using and abusing these so called dynamic lookup operators. In the F# language, we have the ability to define two “dynamic” operators, a get member operator denoted by the ( ? ), and the set member operator denoted by the ( ?<- ). The F# language and its associated libraries do not have an actual implementation of these operators, but instead allow you to implement them as you see fit. Previously, we tried two approaches…
-
Exploring MongoDB with F#
If you’ve been following me on Twitter, I’ve been digging a bit into MongoDB. When I was involved with the planning of NoSQLEast this past year, I sat down and used it in anger and was quite pleased with the results. Using it with a language which allows for quick prototyping such as F# has afforded me to get up and going on a project with very little effort. At some point, I don’t want to be bothered with having to go into another tool, create a schema, decide what data types, run migrations and all the fun things that come along with traditional RDBMS solutions. I just want a quick answer with the data I have. There was one issue of course that nagged me which was the ubiquitous use of strings for everything from databases, collections, and keys. With a language such as F#, could we do any better than this approach?
-
Using and Abusing the F# Dynamic Lookup Operator
Lately, I’ve been playing with such things as MongoDB using F# to rapidly prototype ideas. With that, I’ve tried to rid myself of magic strings by using the F# dynamic lookup operator. I’ll cover exactly what I’m doing in the next post when using MongoDB, but in this post I’d like to explore a little of what you could do with a little noticed dynamic lookup operator in F#.
-
A Kick in the Monads – Writer Edition
In the past couple of Monads posts, we’ve talked briefly about the State and Reader Monads and their potential uses and misuses. Before this series completes, I have a few more to cover including the Writer, Continuation and eventually Observable monad. Today, we’ll get started looking at the Writer Monad and what it can do for us.
-
A Kick in the Monads – Creating Extended Builders Part III
So far in this series, we’ve covered some of the methods you can implement for custom computation expressions (aka Monads) in F# such as bind and return, as well as exception and resource management. For the last part in the series, we’ll take a look at looping constructs. As we know, F# is a pragmatic multi-paradigm language which supports not only functional features, but imperative ones as well, which include mutability, looping constructs and so on. Just as regular F# supports for and while loops, we have the ability to take advantage of them as well inside of our computation expressions by implementing two methods. Let’s start with the while loop.
-
Much Ado About Monads – Creating Extended Builders Part II
In this series, we’ve looked custom computation expressions, what they are, how they are applicable to development and how we might implement them in F#. In the previous post, we went over some of the basic methods you can include on your custom computation expression to allow for a more rich programmatic model than the linear style provided via both Bind and Return.
-
Much Ado About Monads – Creating Extended Builders
In the past two posts in this series, we’ve covered both the State Monad and Reader Monad, not only the motivations, but how you would implement them in F#. With defining the Return and Bind methods on our computation expression builders, we’re able to do composable linear programming. But, what we lack is an imperative programming model on top to allow for such things as if statements, for and while loops, and try/catch or try/finally blocks. Luckily, there is a programmatic model to follow to make these things possible inside of our expressions. Let’s cover each of these functions in turn and see what each one does and in the process implement them for the Reader Monad.