Haskell Core Libraries (base package)ParentContentsIndex
Control.Monad.State
Portability non-portable ( mulit-param classes, functional dependencies )
Stability experimental
Maintainer libraries@haskell.org
Description

State monads.

Inspired by the paper Functional Programming with Overloading and Higher-Order Polymorphism, Mark P Jones (http://www.cse.ogi.edu/~mpj) Advanced School of Functional Programming, 1995.

class (Monad m) => MonadState s m | m -> s where
Methods
get :: m s
put :: s -> m ()
Instances
(MonadState s m) => MonadState s (ContT r m)
(Error e, MonadState s m) => MonadState s (ErrorT e m)
(MonadState s m) => MonadState s (ListT m)
(Monoid w) => MonadState s (RWS r w s)
(Monoid w, Monad m) => MonadState s (RWST r w s m)
MonadState s (State s)
(Monad m) => MonadState s (StateT s m)
(MonadState s m) => MonadState s (ReaderT r m)
(Monoid w, MonadState s m) => MonadState s (WriterT w m)
modify :: (MonadState s m) => (s -> s) -> m ()
gets :: (MonadState s m) => (s -> a) -> m a
data State s a
Constructors
State
runState :: (s -> (a, s))
Instances
Functor (State s)
Monad (State s)
MonadFix (State s)
MonadState s (State s)
runState :: State s a -> s -> (a, s)
evalState :: State s a -> s -> a
execState :: State s a -> s -> s
mapState :: ((a, s) -> (b, s)) -> State s a -> State s b
withState :: (s -> s) -> State s a -> State s a
data StateT s m a
Constructors
StateT
runStateT :: (s -> m (a, s))
Instances
(MonadCont m) => MonadCont (StateT s m)
(MonadError e m) => MonadError e (StateT s m)
(Monad m) => Functor (StateT s m)
(Monad m) => Monad (StateT s m)
(MonadPlus m) => MonadPlus (StateT s m)
(MonadFix m) => MonadFix (StateT s m)
(Monad m) => MonadState s (StateT s m)
MonadTrans (StateT s)
(MonadIO m) => MonadIO (StateT s m)
(MonadReader r m) => MonadReader r (StateT s m)
(MonadWriter w m) => MonadWriter w (StateT s m)
runStateT :: StateT s m a -> s -> m (a, s)
evalStateT :: (Monad m) => StateT s m a -> s -> m a
execStateT :: (Monad m) => StateT s m a -> s -> m s
mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
withStateT :: (s -> s) -> StateT s m a -> StateT s m a
module Control.Monad
module Control.Monad.Fix
module Control.Monad.Trans
Produced by Haddock version 0.4