Difference between revisions of "New monads"

From HaskellWiki
Jump to: navigation, search
Line 48: Line 48:
View [[NewMonads/MonadSTO]].
View [[NewMonads/MonadSTO]].

Revision as of 09:44, 17 September 2006


It seems that the liftIO function from MonadIO can be generalized to access whatever the base of a transformer stack happens to be. So there is no need for a liftSTM, liftST, etc.

View NewMonads/MonadBase.


This is by Iavor S. Diatchki and can be found at http://www.cse.ogi.edu/~diatchki/monadLib/

It is a new version of the mtl package with transformers: ReaderT WriterT StateT ExceptT SearchT ContT

It also defines BaseM which is like MonadBase above.


This came up on the mailing list: Why is WriterT never lazy? The answer is it does not use lazy patterns with "~". So here is a more useful NewMonads/LazyWriterT that add two "~" to the definition of (>>=) and renames WriterT to LazyWriterT.


A simple monad transformer to allow computations in the transformed monad to generate random values.

View NewMonads/MonadRandom.


Here is a simple monad/monad transformer for computations which consume values from a (finite or infinite) supply. Note that due to pattern matching, running out of supply in a non-MonadZero monad will cause an error.

View NewMonads/MonadSupply.


Here is a modified state monad transformer for keeping track of undo/redo states automatically.

View NewMonads/MonadUndo.


This is a simple (trivial) monad transformer for supplying unique integer values to an algorithm.

View NewMonads/MonadUnique.


Here's an extension of the ST monad in which the references are ordered and showable (they list their creation index).

View NewMonads/MonadSTO.