eff-0.0.0.0
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Reader

Synopsis

Documentation

data Reader r :: Effect where Source #

The Reader r effect provides access to a global environment of type r.

Handlers should obey the law f <$> asklocal f ask.

Constructors

Ask :: Reader r m r 
Local :: (r1 -> r2) -> Eff (Reader r2 ': effs) a -> Reader r1 (Eff effs) a 

ask :: Reader r :< effs => Eff effs r Source #

Retrieves a value from the environment.

local :: Reader r1 :< effs => (r1 -> r2) -> Eff (Reader r2 ': effs) a -> Eff effs a Source #

Runs a subcomputation in an environment modified by the given function.

runReader :: r -> Eff (Reader r ': effs) a -> Eff effs a Source #

Handles a Reader effect by supplying a value for the environment.