I'd like to use Haskell for stochastic simulation, but I don't know how. I've read Hutton's 'Programming in Haskell', and I'm comfortable writing deterministic functional programs. However, I don't know how to start writing stochastic simulations of the sort that are easy in imperative languages like R or python. Is there a tutorial or primer on this that I could read, or can anyone provide some tips on getting started?
2 Answers
There's a nice self-contained paper Erwig and Kollmansberger: Functional Pearls - Probabilistic Functional Programming in Haskell on this topic. I used this as a starting point for writing a natural language processor based on Hidden Markov Models in Haskell. There's a package that is based on this paper, which also seems to provide a basic interface to R plotting.
There's also an entry on the HaskellWiki with more links to hackage. In particular, the ProbabilityMonads package might be useful for you.

- 1,693
- 13
- 18
-
Thank you - that looks interesting. – Marius Kempe Mar 21 '13 at 20:38
http://learnyouahaskell.com/a-fistful-of-monads#the-list-monad
This small section in Learn You a Haskell talks about using the List monad and functor functions to easily deal with non-determinism. May be a little simplistic depending on what your needs are, but make good use of the tools that are already in the standard library.

- 117
- 3