| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Monad.Trans.Ether.Reader
Description
- type Reader tag r = ReaderT tag r Identity
- reader :: Monad m => proxy tag -> (r -> a) -> ReaderT tag r m a
- runReader :: proxy tag -> Reader tag r a -> r -> a
- data ReaderT tag r m a
- readerT :: proxy tag -> (r -> m a) -> ReaderT tag r m a
- runReaderT :: proxy tag -> ReaderT tag r m a -> r -> m a
- mapReaderT :: proxy tag -> (m a -> n b) -> ReaderT tag r m a -> ReaderT tag r n b
- withReaderT :: proxy tag -> (r' -> r) -> ReaderT tag r m a -> ReaderT tag r' m a
- ask :: Monad m => proxy tag -> ReaderT tag r m r
- local :: proxy tag -> (r -> r) -> ReaderT tag r m a -> ReaderT tag r m a
- liftCatch :: proxy tag -> Catch e m a -> Catch e (ReaderT tag r m) a
- liftCallCC :: proxy tag -> CallCC m a b -> CallCC (ReaderT tag r m) a b
The Reader monad
reader :: Monad m => proxy tag -> (r -> a) -> ReaderT tag r m a Source
Constructor for computations in the reader monad
(the inverse of runReader).
runReader :: proxy tag -> Reader tag r a -> r -> a Source
Runs a ReaderT with the given environment
and returns the vinal value.
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.
Instances
readerT :: proxy tag -> (r -> m a) -> ReaderT tag r m a Source
Constructor for computations in the reader monad transformer.
runReaderT :: proxy tag -> ReaderT tag r m a -> r -> m a Source
Runs a ReaderT with the given environment
and returns the vinal value.
mapReaderT :: proxy tag -> (m a -> n b) -> ReaderT tag r m a -> ReaderT tag r n b Source
Transform the computation inside a ReaderT.
runReaderTtag (mapReaderTtag f m) = f .runReaderTtag m
Arguments
| :: proxy tag | |
| -> (r' -> r) | The function to modify the environment. |
| -> ReaderT tag r m a | Computation to run in the modified environment. |
| -> ReaderT tag r' m a |
Execute a computation in a modified environment
(a more general version of local).
runReaderTtag (withReaderTtag f m) =runReaderTtag m . f
Reader operations
Arguments
| :: proxy tag | |
| -> (r -> r) | The function to modify the environment. |
| -> ReaderT tag r m a | Computation to run in the modified environment. |
| -> ReaderT tag r m a |
Execute a computation in a modified environment
(a specialization of withReaderT).
runReaderTtag (localtag f m) =runReaderTtag m . f
Lifting other operations
liftCatch :: proxy tag -> Catch e m a -> Catch e (ReaderT tag r m) a Source
Lift a catchE operation to the new monad.
liftCallCC :: proxy tag -> CallCC m a b -> CallCC (ReaderT tag r m) a b Source
Lift a callCC operation to the new monad.