effet-0.4.0.0: An Effect System based on Type Classes

Control.Effect.State.Strict

Description

Strict interpretations of the State' effect.

If you don't require disambiguation of multiple state effects (i.e., you only have one state effect in your monadic context), you usually need the untagged interpretations.

Synopsis

# Tagged Interpretations

Arguments

 :: forall tag s m a. Functor m => s The initial state. -> (State' tag s Via StateT s) m a The program whose state effect should be handled. -> m a The program with its state effect handled.

Runs the state effect and discards the final state.

Arguments

 :: forall tag s m a. Functor m => s The initial state. -> (State' tag s Via StateT s) m a The program whose state effect should be handled. -> m s The program with its state effect handled, producing the final state s.

Runs the state effect and returns the final state.

Arguments

 :: forall tag s m a. Functor m => s The initial state. -> (State' tag s Via StateT s) m a The program whose state effect should be handled. -> m (s, a) The program with its state effect handled, producing the final state s and the result a.

Runs the state effect and returns both the final state and the result of the interpreted program.

# Untagged Interpretations

evalState :: Functor m => s -> (State s Via StateT s) m a -> m a Source #

execState :: Functor m => s -> (State s Via StateT s) m a -> m s Source #

runState :: Functor m => s -> (State s Via StateT s) m a -> m (s, a) Source #