Archives

Archives / 2010 / January
  • 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.

  • [ANN] DC ALT.NET – 1/27/2010 - Clojure

    The next meeting of DC ALT.NET will be held on January 27th from 7-9PM on Clojure with Craig Andera.  Previously, he gave a talk about spending some time in Common Lisp and some of the lessons learned during his adventures.  You may have noticed a lot of talk around this language, especially in the Java community.  Where trends are concerned, momentum has shifted from Groovy to Scala and now to Clojure just in terms of sheer interest.  It’s one that’s on the top of my list to dive deep into this year.  So, what is it and what should we care?

  • Much Ado About Monads – Reader Edition

    In the previous post, we talked a bit about the State Monad, what it is and how you could use it today in your F# application.  But, with any new piece of information such as this, it should be taken in context, and there are other patterns as well when dealing with a multi-paradigm language such as F#.  We also talked about how the State Monad might not have been the best choice for modeling our web scripting DSL as our browser state is encapsulated in the Browser class, and once it is set, it doesn’t change.  With that, we could turn our eyes to using the Reader Monad as we read from our environment.