ether-0.4.1.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 # 

Methods

get :: proxy s -> m (t m) Source #

put :: proxy s -> t m -> m () Source #

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

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

Methods

get :: proxy s -> m (StateT k tag s' m) Source #

put :: proxy s -> StateT k tag s' m -> m () Source #

state :: proxy s -> (StateT k tag s' m -> (a, StateT k tag s' m)) -> m a Source #

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

Methods

get :: proxy s -> m (StateT k tag s' m) Source #

put :: proxy s -> StateT k tag s' m -> m () Source #

state :: proxy s -> (StateT k tag s' m -> (a, StateT k tag s' m)) -> m a 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.