effet-0.3.0.2: An Effect System based on Type Classes

Copyright(c) Michael Szvetits 2020
LicenseBSD3 (see the file LICENSE)
Maintainertypedbyte@qualified.name
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Control.Effect.State.Strict

Contents

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

evalState' Source #

Arguments

:: 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.

execState' Source #

Arguments

:: 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.

runState' Source #

Arguments

:: 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 #

The untagged version of evalState'.

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

The untagged version of execState'.

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

The untagged version of runState'.