[Haskell-cafe] Building Monads from Monads

Cale Gibbard cgibbard at gmail.com
Thu Mar 23 23:49:17 EST 2006


Oh, and almost forgot, you can check out lots of examples of this not
only in the mtl, but also on the (old) Haskell Wiki. I've written a
lot of simple (sometimes trivial) examples for people to look at

Unique values -- very simple
http://www.haskell.org/hawiki/MonadUnique

A supply of values, a slight generalisation of the above
http://www.haskell.org/hawiki/MonadSupply

Random number generation
http://www.haskell.org/hawiki/MonadRandom

A state monad transformer with undo/redo
http://www.haskell.org/hawiki/MonadUndo

Last but not least, check out my Sudoku solver (everyone has one of
these nowadays). I wrote it by constructing a special monad, in which
the problem becomes really easy to solve. (Basically, a state monad
which enforces the sudoku rules, and handles nondeterminism
automatically).
http://www.haskell.org/hawiki/SudokuSolver

hope this all helps :)
 - Cale


More information about the Haskell-Cafe mailing list