| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Agda.Utils.StrictState
Description
This is a plain strict state monad, where state update, monadic binding and return are all strict. If you only need a single strict state effect, use this module.
Do not use Control.Monad.State.Strict for the same purpose; it's not even strict in state updates
and is much less amenable to GHC optimizations than this module.
Synopsis
- class Monad m => MonadState s (m :: Type -> Type) | m -> s where
- evalState :: State s a -> s -> a
- evalStateT :: Monad m => StateT s m a -> s -> m a
- execState :: State s a -> s -> s
- execStateT :: Monad m => StateT s m a -> s -> m s
- gets :: MonadState s m => (s -> a) -> m a
- modify :: MonadState s m => (s -> s) -> m ()
- runState :: State s a -> s -> (a, s)
- runStateT :: Monad m => StateT s m a -> s -> m (a, s)
- newtype State s a = State {
- runState# :: s -> (# a, s #)
- newtype StateT s (m :: Type -> Type) a = StateT {
- runStateT# :: s -> m (Pair a s)
Documentation
class Monad m => MonadState s (m :: Type -> Type) | m -> s where #
Minimal definition is either both of get and put or just state
Methods
Return the state from the internals of the monad.
Replace the state inside the monad.
state :: (s -> (a, s)) -> m a #
Embed a simple state action into the monad.
Instances
evalStateT :: Monad m => StateT s m a -> s -> m a Source #
execStateT :: Monad m => StateT s m a -> s -> m s Source #
gets :: MonadState s m => (s -> a) -> m a Source #
modify :: MonadState s m => (s -> s) -> m () Source #
newtype StateT s (m :: Type -> Type) a Source #
Constructors
| StateT | |
Fields
| |
Instances
| MonadReader r m => MonadReader r (StateT s m) Source # | |
| Monad m => MonadState s (StateT s m) Source # | |
| MonadTransControl (StateT s) Source # | |
| MonadTrans (StateT s) Source # | |
Defined in Agda.Utils.StrictState | |
| Monad m => Applicative (StateT s m) Source # | |
Defined in Agda.Utils.StrictState | |
| Functor m => Functor (StateT s m) Source # | |
| Monad m => Monad (StateT s m) Source # | |
| MonadIO m => MonadIO (StateT s m) Source # | |
Defined in Agda.Utils.StrictState | |
| ExpandCase (m (Pair a s)) => ExpandCase (StateT s m a) Source # | |
| type StT (StateT s) a Source # | |
Defined in Agda.Utils.StrictState | |
| type Result (StateT s m a) Source # | |
Defined in Agda.Utils.StrictState | |