extensible-effects-1.5.0: An Alternative to Monad Transformers

Safe HaskellTrustworthy



Lazy read-only state



data Reader e v Source

The request for a value of type e from the current environment. This environment is analogous to a parameter of type e.


ask :: (Typeable e, Member (Reader e) r) => Eff r eSource

Get the current value from a Reader.

local :: (Typeable e, Member (Reader e) r) => (e -> e) -> Eff r a -> Eff r aSource

Locally rebind the value in the dynamic environment. This function both requests and admins Reader requests.

reader :: (Typeable e, Member (Reader e) r) => (e -> a) -> Eff r aSource

Request the environment value using a transformation function.

runReader :: Typeable e => Eff (Reader e :> r) w -> e -> Eff r wSource

The handler of Reader requests. The return type shows that all Reader requests are fully handled.