CodePlexProject Hosting for Open Source Software

Unified collection of Monads (M, unit, *) implemented in the Microsoft F# Language.

In functional programming, a monad is a kind of abstract data type used to represent computations (instead of data in the domain model). Monads allow the programmer to chain actions together to build a pipeline, in which each action is decorated with additional processing rules provided by the monad. Programs written in functional style can make use of monads to structure procedures that include sequenced operations, or to define arbitrary control flows (like handling concurrency, continuations, or exceptions).

Formally, a monad is constructed by defining two operations (bind and return) and a type constructor M that must fulfill several properties to allow the correct composition of monadic functions (i.e. functions that use values from the monad as their arguments). The return operation puts a value from a plain type into a monadic container of type M. The bind operation performs the reverse process, extracting the original value from the container and passing it to the associated next function in the pipeline.

(From Wikipedia. http://en.wikipedia.org/wiki/Monad_(functional_programming))

Done:

- Identity
- Maybe
- State
- List
- Error
- Continuation

In Progress:

- Parser

To do:

- IO
- ....

The monads are implemented in F#, but they can be used from both C# (LINQ) and F# (Computation expression)

References:

An Abstract View of Programming Languages by Eugenio Moggi

Monads for functional programming Philip Wadler

Merging Monads and Folds for Functional Programming by Erik Meijer , Johan Jeuring

The essence of functional programming

Monad Comprehensions: A Versatile Representation for Queries Torsten Grust

Real World Haskell: Code You Can Believe In (Paperback)

Monadic Parsing in Haskell by Graham Hutton and Erik Meijer

Monadic Parser Combinators by Graham Hutton and Erik Meijer

Last edited Jun 23, 2010 at 11:23 PM by holoed, version 24