ether-0.4.0.0: Monad transformers and classes

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Ether.State.Class

Description

Synopsis

Documentation

class Monad m => MonadState tag s m | m tag -> s where Source

Minimal complete definition

state | get, put

Methods

get :: proxy tag -> m s Source

Return the state from the internals of the monad.

put :: proxy tag -> s -> m () Source

Replace the state inside the monad.

state :: proxy tag -> (s -> (a, s)) -> m a Source

Embed a simple state action into the monad.

Instances

(MonadTrans t, Monad (t m), MonadState k tag s m) => MonadState k tag s (t m) Source 
(Monad m, (~) * s s') => MonadState k tag s (StateT k tag s' m) Source 
(Monad m, (~) * s s') => MonadState k tag s (StateT k tag s' m) Source 

modify :: MonadState tag s m => proxy tag -> (s -> s) -> m () Source

Modifies the state inside a state monad.

gets :: MonadState tag s m => proxy tag -> (s -> a) -> m a Source

Gets specific component of the state, using a projection function supplied.