Personal tools

New monads

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(MonadRandom: link, subhead to splittable)
(add MonadAdvSTM)
Line 55: Line 55:
   
 
View [[New monads/MonadSTO]].
 
View [[New monads/MonadSTO]].
  +
  +
== MonadAdvSTM ==
  +
  +
Here is an extension of STM to easy interaction with IO after committing or retrying. Inspired by Simon P-J.
  +
  +
View [[New monads/MonadAdvSTM]].
   
 
[[Category:Idioms]]
 
[[Category:Idioms]]

Revision as of 14:36, 24 November 2006

Contents


Remember to add a [ [ Category:Code ] ] tag to any new sub-pages.

1 MonadBase

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 New monads/MonadBase.

2 MonadLib

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.

3 LazyWriterT

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 New monads/LazyWriterT that add two "~" to the definition of (>>=) and renames WriterT to LazyWriterT.

4 MonadRandom

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

View New monads/MonadRandom.

4.1 MonadRandomSplittable

A refinement of MonadRandom to integrate RandomGen's split function.

View at New monads/MonadRandomSplittable

5 MonadSupply

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 New monads/MonadSupply.

6 MonadUndo

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

View New monads/MonadUndo.

7 MonadUnique

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

View New monads/MonadUnique.

8 MonadSTO

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

View New monads/MonadSTO.

9 MonadAdvSTM

Here is an extension of STM to easy interaction with IO after committing or retrying. Inspired by Simon P-J.

View New monads/MonadAdvSTM.