- interface MonadState : Type -> (Type -> Type) -> Type
A computation which runs in a context and produces an output
Parameters: stateType, m
Constraints: Monad m
Methods:
- get : m stateType
Get the context
- put : stateType -> m ()
Write a new context/output
- state : (stateType -> (stateType, a)) -> m a
Embed a simple state action into the monad.
Implementations:
- Monad m => MonadState stateType (StateT stateType m)
- MonadState s m => MonadState s (EitherT e m)
- MonadState s m => MonadState s (MaybeT m)
- Monad m => MonadState s (RWST r w s m)
- MonadState s m => MonadState s (ReaderT r m)
- MonadState s m => MonadState s (WriterT r m)
- get : MonadState stateType m => m stateType
Get the context
Totality: total- gets : MonadState stateType m => (stateType -> a) -> m a
Evaluate a function in the context held by this computation
Totality: total- modify : MonadState stateType m => (stateType -> stateType) -> m ()
Apply a function to modify the context of this computation
Totality: total- put : MonadState stateType m => stateType -> m ()
Write a new context/output
Totality: total- state : MonadState stateType m => (stateType -> (stateType, a)) -> m a
Embed a simple state action into the monad.
Totality: total