Copyright | (c) Ivan Lazar Miljenovic |
---|---|
License | 3-Clause BSD-style |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Provides a shared environment for reading values and executing sub-computations in a modified environment.
- ask :: HasReader r m => m r
- asks :: HasReader r m => (r -> a) -> m a
- reader :: forall r m a. HasReader r m => (r -> a) -> m a
- local :: forall r m a. HasReader r m => (r -> r) -> m a -> m a
- newtype ReaderT r m a :: * -> (* -> *) -> * -> * = ReaderT {
- runReaderT :: r -> m a
- type HasReader r m = SatisfyConstraint (IsReader r) m
- class MonadTower m => IsReader r m
Documentation
asks :: HasReader r m => (r -> a) -> m a Source
Retrieve a function of the current environment. An alias of
reader
.
reader :: forall r m a. HasReader r m => (r -> a) -> m a Source
Retrieve a function of the current environment.
local :: forall r m a. HasReader r m => (r -> r) -> m a -> m a Source
Execute a computation in a modified environment.
newtype ReaderT r m a :: * -> (* -> *) -> * -> *
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.
ReaderT | |
|
MonadTower m => IsReader r (ReaderT r m) | |
MonadTrans (ReaderT r) | |
MonadLevel m => ConstraintPassThrough (IsTransformer (ReaderT r)) (ListT m) True | |
MonadLevel m => ConstraintPassThrough (IsTransformer (ReaderT r)) (ContT c m) True | |
Alternative m => Alternative (ReaderT r m) | |
Monad m => Monad (ReaderT r m) | |
Functor m => Functor (ReaderT r m) | |
MonadFix m => MonadFix (ReaderT r m) | |
MonadPlus m => MonadPlus (ReaderT r m) | |
Applicative m => Applicative (ReaderT r m) | |
MonadIO m => MonadIO (ReaderT r m) | |
MonadTower m => MonadLevel_ (ReaderT r m) | |
MonadTower m => MonadTower_ (ReaderT r m) | |
type LowerMonad (ReaderT r m) = m | |
type WithLower_ (ReaderT r m) = AddIdent | |
type AllowOtherValues (ReaderT r m) = True | |
type DefaultAllowConstraints (ReaderT r m) = True | |
type BaseMonad (ReaderT r m) = BaseMonad m | |
type InnerValue (ReaderT r m) a = a |
type HasReader r m = SatisfyConstraint (IsReader r) m Source
A monad stack containing a Reader environment of type r
.
class MonadTower m => IsReader r m Source
The minimal definitions needed by a monad providing a Reader environment.
IsReader r ((->) r) | |
MonadTower m => IsReader r (ReaderT r m) | |
(MonadTower m, Monoid w) => IsReader r (RWST r w s m) | |
(MonadTower m, Monoid w) => IsReader r (RWST r w s m) | |
ValidConstraint (IsReader r) | |
MonadTower m => ConstraintPassThrough (IsReader r) (ListT m) True | |
MonadTower m => ConstraintPassThrough (IsReader r) (ContT c m) True | |
type ConstraintSatisfied (IsReader r) m |