deepcontrol-0.1.0.0: Enable deeper level style of programming than the usual control provides

Safe HaskellSafe
LanguageHaskell2010

DeepControl.Monad.State

Synopsis

Documentation

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

Minimal definition is either both of get and put or just state

Minimal complete definition

state | get, put

Methods

get :: m s

Return the state from the internals of the monad.

put :: s -> m ()

Replace the state inside the monad.

state :: (s -> (a, s)) -> m a

Embed a simple state action into the monad.

Instances

MonadState s m => MonadState s (MaybeT m) 
MonadState s m => MonadState s (ListT m) 
MonadState s m => MonadState s (IdentityT m) 
MonadState s (State s) 
(Monoid w, MonadState s m) => MonadState s (WriterT w m) 
(Monoid w, MonadState s m) => MonadState s (WriterT w m) 
Monad m => MonadState s (StateT s m) 
Monad m => MonadState s (StateT s m) 
MonadState s m => MonadState s (ReaderT r m) 
MonadState s m => MonadState s (ExceptT e m) 
(Error e, MonadState s m) => MonadState s (ErrorT e m) 
MonadState s m => MonadState s (ContT r m) 
Monoid w => MonadState s (RWS r w s) 
(Monad m, Monoid w) => MonadState s (RWST r w s m) 
(Monad m, Monoid w) => MonadState s (RWST r w s m) 

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

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

newtype State s a Source

Constructors

State 

Fields

runState :: s -> (a, s)
 

evalState :: State s a -> s -> a Source

execState :: State s a -> s -> s Source