# The F# Computation Expression Zoo

This web site is an online appendix for a paper The F# Computation Expression Zoo. It complements the theory discussed in the paper, with a complete source code for all sample computations that are used in the paper.

The commented source code can be viewed in the left pannel. However, it is also possible to run the code samples using an Interactive F# console based on the Try F# project. The console is based on Silverlight, which is currently available for Windows and Mac. On Linux, it is possible to run the samples using Mono.

• Functional monads and laws discusses the definition of computation expression for a monad in terms of bind and return and shows syntactic equalities that correspond to well-known monad laws.

• Sequencing of monads shows how (untracked) effects can be handled in computation expressions. The section shows both approaches - for monadic containers and for monadic computations.

• Monadic control flow extends the previous definitions of a monad with additional control flow constructs including `for` and `while` loops and exception handling constructs.

### Semigroups and monoids

• Monoidal computation shows how to define computatione expressions for a simple monoidal structure. It discusses the ways of embedding effects in monoidal computations and shows syntactic equalities that correspond to monoid laws.

### Composed computations

• Additive parsers shows one alternative syntax for working with computations that are monadic and monoidal at the same time. The syntax is demonstrated using parser combinators.

• Additive sequences shows an alternative syntax for working with monadic and monoidal computation. The syntax emphasizes the monoidal structure and is demonstrated using lists.

• Layered monads demonstrates a computation expression that can be used to work with computations that are formed by composing monads. The example is based on monad transformers known from Haskell.

### Applicative functors

• Applicative functors demonstrates a research extension for F# that allows using applicative functors (also called idioms) using the computation expression syntax. An example uses formlets that are used for building HTML forms.