eff-0.0.0.0
Safe HaskellNone
LanguageHaskell2010

Control.Effect.State

Synopsis

Documentation

data State s :: Effect where Source #

The State s effect provides access to a single cell of mutable state of type s.

Constructors

Get :: State s m s 
Put :: ~s -> State s m () 

get :: State s :< effs => Eff effs s Source #

Retrieves the current value of the state.

put :: State s :< effs => s -> Eff effs () Source #

Replaces the current state with the given value.

modify :: State s :< effs => (s -> s) -> Eff effs () Source #

Modifies the current state by applying the given function to it.