Copyright | Copyright (c) 2008--2015 wren gayle romano |
---|---|

License | BSD |

Maintainer | wren@community.haskell.org |

Stability | perpetually unstable |

Portability | semi-portable (MPTCs) |

Safe Haskell | Safe |

Language | Haskell98 |

This module defines some extra functions for Control.Monad.State.Lazy. This package really isn't the proper place for these, but we need them to be somewhere.

TODO: patch transformers/mtl-2 with these functions.

- liftReader :: Reader e a -> State e a
- liftReaderT :: Monad m => ReaderT e m a -> StateT e m a
- modify' :: MonadState s m => (s -> s) -> m ()
- localState :: MonadState s m => m a -> m a

# Additional functions for MTL

liftReader :: Reader e a -> State e a Source

Lift a reader into a state monad. More particularly, this
allows disabling mutability in a local context within `State`

.

liftReaderT :: Monad m => ReaderT e m a -> StateT e m a Source

Lift a reader into a state monad. More particularly, this
allows disabling mutability in a local context within `StateT`

.

modify' :: MonadState s m => (s -> s) -> m () Source

A strict version of `modify`

.

localState :: MonadState s m => m a -> m a Source

Run a state action and undo the state changes at the end.