IdrisDoc: Control.Monad.State

Control.Monad.State

interface MonadState 

A computation which runs in a context and produces an output

get : MonadState stateType m => m stateType

Get the context

put : MonadState stateType m => stateType -> m ()

Write a new context/output

ST : (runStateT : stateType -> m (a, stateType)) -> StateT stateType m a
State : (stateType : Type) -> (ty : Type) -> Type

The State monad. See the MonadState interface

record StateT stateType m a

The transformer on which the State monad is based

stateType
 
m
 
a
 
ST : (runStateT : stateType -> m (a, stateType)) -> StateT stateType m a
runStateT : (rec : StateT stateType m a) -> stateType -> m (a, stateType)
evalState : State stateType a -> stateType -> a

Unwrap a State monad computation, but discard the final state.

execState : State stateType a -> stateType -> stateType

Unwrap a State monad computation, but discard the resulting value.

gets : MonadState stateType m => (stateType -> a) -> m a

Evaluate a function in the context held by this computation

modify : MonadState stateType m => (stateType -> stateType) -> m ()

Apply a function to modify the context of this computation

runState : StateT stateType Identity a -> stateType -> (a, stateType)

Unwrap a State monad computation.