Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Reader r m k
- ask :: (Member (Reader r) sig, Carrier sig m) => m r
- asks :: (Member (Reader r) sig, Carrier sig m) => (r -> a) -> m a
- local :: (Member (Reader r) sig, Carrier sig m) => (r -> r) -> m a -> m a
- runReader :: forall r sig m a. (Carrier sig m, Monad m) => r -> Eff (ReaderC r m) a -> m a
- newtype ReaderC r m a = ReaderC {
- runReaderC :: r -> m a
Documentation
ask :: (Member (Reader r) sig, Carrier sig m) => m r Source #
Retrieve the environment value.
run (runReader a ask) == a
asks :: (Member (Reader r) sig, Carrier sig m) => (r -> a) -> m a Source #
Project a function out of the current environment value.
snd (run (runReader a (asks (applyFun f)))) == applyFun f a
local :: (Member (Reader r) sig, Carrier sig m) => (r -> r) -> m a -> m a Source #
Run a computation with an environment value locally modified by the passed function.
run (runReader a (local (applyFun f) ask)) == applyFun f a
run (runReader a ((,,) <$> ask <*> local (applyFun f) ask <*> ask)) == (a, applyFun f a, a)