|
| Control.Monad.Trans.Reader | | Portability | portable | | Stability | experimental | | Maintainer | libraries@haskell.org |
|
|
|
|
|
| Description |
Declaration of the ReaderT monad transformer, which adds a static
environment to a given monad.
If the computation is to modify the stored information, use
Control.Monad.Trans.State instead.
|
|
| Synopsis |
|
|
|
|
| The Reader monad
|
|
|
The parameterizable reader monad.
Computations are functions of a shared environment.
The return function ignores the environment, while >>= passes
the inherited environment to both subcomputations.
|
|
|
| Constructor for computations in the reader monad.
|
|
|
| :: | | | => Reader r a | An initial environment.
| | -> r | | | -> a | | | Runs a Reader and extracts the final value from it.
|
|
|
|
| Transform the value returned by a Reader.
|
|
|
| :: | | | => r' -> r | Computation to run in the modified environment.
| | -> Reader r a | | | -> Reader r' a | | | Execute a computation in a modified environment
(a specialization of withReaderT).
|
|
|
| The ReaderT monad transformer
|
|
|
The reader monad transformer,
which adds a read-only environment to the given monad.
The return function ignores the environment, while >>= passes
the inherited environment to both subcomputations.
| | Constructors | | ReaderT | | | runReaderT :: r -> m a | The underlying computation, as a function of the environment.
|
|
|
|
|
|
| Transform the computation inside a ReaderT.
|
|
|
| :: | | | => r' -> r | Computation to run in the modified environment.
| | -> ReaderT r m a | | | -> ReaderT r' m a | | | Execute a computation in a modified environment
(a more general version of local).
|
|
|
| Reader operations
|
|
|
| Fetch the value of the environment.
|
|
|
| :: Monad m | | | => r -> r | Computation to run in the modified environment.
| | -> ReaderT r m a | | | -> ReaderT r m a | | | Execute a computation in a modified environment
(a specialization of withReaderT).
|
|
|
|
| :: Monad m | | | => r -> a | | | -> ReaderT r m a | | | Retrieve a function of the current environment.
|
|
|
| Lifting other operations
|
|
|
| :: | | | => ((a -> m b) -> m a) -> m a | | | -> (a -> ReaderT r m b) -> ReaderT r m a | | | -> ReaderT r m a | | | Lift a callCC operation to the new monad.
|
|
|
|
| :: | | | => m a -> (e -> m a) -> m a | Computation to attempt.
| | -> ReaderT r m a | Exception handler.
| | -> e -> ReaderT r m a | | | -> ReaderT r m a | | | Lift a catchError operation to the new monad.
|
|
|
| Produced by Haddock version 2.6.0 |