Creative uses of monads

Solution 1:

Phil Wadler has written many papers on monads, but the one to read first is a lot of fun and will be accessible to any programmer; it's called The essence of functional programming. The paper includes source code and sample usages.

A personal favorite of mine is the probability monad; if you can find Sungwoo Park's PhD thesis, it has a number of interesting example codes from robotics.

Solution 2:

There's also LogicT (backtracking monad transformer with fair operations and pruning).

It has good value to AI Search algorithms because of its constructs for fair disjunctions, for example, easily enabling computations that succeed an infinite number of times to be combined (interleaved).

It's usage is described in the ICFP'05 paper Backtracking, Interleaving, and Terminating Monad Transformers

Solution 3:

you can find interesting and advanced monads in the blog A Neighborhood of Infinity. I can note the Vector Space Monad, and its use for rational tangles description. Unfortunately,I don't think I understand this well enough to explain it here.

Solution 4:

One of my favorite monads is Martin Escardo's search monad. It can be found on hackage in infinite-search package.

It is the monad of "search functions" for a set of elements of type a, namely (a -> Bool) -> Maybe a (finding an element in the set matching a given predicate).