freer-effects-0.3.0.0: Implementation of effect system for Haskell.

Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.
LicenseBSD3
Maintainerixcom-core@ixperta.com
Stabilityexperimental
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Freer.StateRW

Description

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 http://okmij.org/ftp/Haskell/extensible/Eff1.hs as a starting point.

Synopsis

Documentation

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.