Safe Haskell | None |
---|---|
Language | Haskell2010 |
An effect providing access to an immutable (but locally-modifiable) context value.
This effect is similar to the traditional MonadReader
typeclass, though it allows the presence of multiple Reader t
effects.
Predefined carriers:
- Control.Carrier.Reader.
- Control.Monad.Trans.Reader.
- Control.Monad.Trans.RWS.Lazy
- Control.Monad.Trans.RWS.Strict
- If
Reader
r
is the last effect in a stack, it can be interpreted directly to(-> r)
(a function taking anr
).
Since: 0.1.0.0
Reader effect
Since: 0.1.0.0
Instances
Effect (Reader r) Source # | |
HFunctor (Reader r) Source # | |
Algebra (Reader r) ((->) r :: Type -> Type) Source # | |
Defined in Control.Algebra | |
Functor m => Functor (Reader r m) Source # | |
Algebra sig m => Algebra (Reader r :+: sig) (ReaderT r m) Source # | |
Algebra sig m => Algebra (Reader r :+: sig) (ReaderC r m) Source # | |
(Algebra sig m, Effect sig, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # | |
(Algebra sig m, Effect sig, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # | |
local :: Has (Reader r) sig m => (r -> r) -> m a -> m a Source #
Run a computation with an environment value locally modified by the passed function.
runReader a (local
f m) = runReader (f a) m
Since: 0.1.0.0
Re-exports
class (HFunctor sig, Monad m) => Algebra sig m | m -> sig Source #
The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the alg
method.
Since: 1.0.0.0
Instances
type Has eff sig m = (Members eff sig, Algebra sig m) Source #
m
is a carrier for sig
containing eff
.
Note that if eff
is a sum, it will be decomposed into multiple Member
constraints. While this technically allows one to combine multiple unrelated effects into a single Has
constraint, doing so has two significant drawbacks:
- Due to a problem with recursive type families, this can lead to significantly slower compiles.
- It defeats
ghc
’s warnings for redundant constraints, and thus can lead to a proliferation of redundant constraints as code is changed.