# New monads

### From HaskellWiki

m |
m (Move a few pages over from old wiki) |
||

Line 18: | Line 18: | ||

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

− | |||

View [[NewMonads/MonadRandom]]. |
View [[NewMonads/MonadRandom]]. |
||

+ | |||

+ | == 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 [[NewMonads/MonadSupply]]. |
||

+ | |||

+ | == MonadUndo == |
||

+ | |||

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

+ | |||

+ | View [[NewMonads/MonadUndo]]. |
||

+ | |||

+ | == MonadUnique == |
||

+ | |||

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

+ | |||

+ | View [[NewMonads/MonadUnique]]. |

## Revision as of 17:28, 24 August 2006

## Contents |

## 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 NewMonads/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 MonadRandom

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

View NewMonads/MonadRandom.

## 4 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 NewMonads/MonadSupply.

## 5 MonadUndo

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

View NewMonads/MonadUndo.

## 6 MonadUnique

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

View NewMonads/MonadUnique.