extensible-effects-1.7.1.0: An Alternative to Monad Transformers

Safe HaskellTrustworthy
LanguageHaskell98

Control.Eff.State.Lazy

Description

Lazy state effect

Synopsis

Documentation

data State s w Source

Strict state effect

Constructors

State (s -> s) (s -> w) 

Instances

Functor (State s) 
Typeable (* -> * -> *) State 

get :: (Typeable e, Member (State e) r) => Eff r e Source

Return the current value of the state.

put :: (Typeable e, Member (State e) r) => e -> Eff r () Source

Write a new value of the state.

modify :: (Typeable s, Member (State s) r) => (s -> s) -> Eff r () Source

Transform the state with a function.

runState Source

Arguments

:: Typeable s 
=> s

Initial state

-> Eff (State s :> r) w

Effect incorporating State

-> Eff r (s, w)

Effect containing final state and a return value

Run a State effect.

evalState :: Typeable s => s -> Eff (State s :> r) w -> Eff r w Source

Run a State effect, discarding the final state.

execState :: Typeable s => s -> Eff (State s :> r) w -> Eff r s Source

Run a State effect and return the final state.