freer-effects- Implementation of effect system for Haskell.

Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.
PortabilityGHC specific language extensions.
Safe HaskellNone



Composable handler for State effects in terms of Reader and Writer effects. This module is more a tutorial on how to compose handlers. It is slightly slower than a dedicated State handler.

Using as a starting point.



runStateR :: Eff (Writer s ': (Reader s ': effs)) a -> s -> Eff effs (a, s) Source #

State handler, using Reader and Writer effects.

data Reader e a Source #

Represents shared immutable environment of type (e :: *) which is made available to effectful computation.

data Writer w a Source #

Writer effects - send outputs to an effect environment.

tell :: Member (Writer w) effs => w -> Eff effs () Source #

Send a change to the attached environment.

ask :: Member (Reader e) effs => Eff effs e Source #

Request a value of the environment.