extensible-effects- An Alternative to Monad Transformers

Safe HaskellTrustworthy



Strict read-only state



newtype 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.


Reader (e -> v) 


Functor (Reader e) 
Typeable (* -> * -> *) Reader 

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

Get the current value from a Reader.

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

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 a Source

Request the environment value using a transformation function.

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

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