Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type State tag r = StateT tag r Identity
- state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a
- runState :: proxy tag -> State tag s a -> s -> (a, s)
- evalState :: proxy tag -> State tag s a -> s -> a
- execState :: proxy tag -> State tag s a -> s -> s
- type StateT tag s = TaggedTrans tag (StateT s)
- stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a
- runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s)
- evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a
- execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s
- get :: Monad m => proxy tag -> StateT tag s m s
- put :: Monad m => proxy tag -> s -> StateT tag s m ()
The State monad
state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a Source
Constructor for computations in the state monad
(the inverse of runState
).
runState :: proxy tag -> State tag s a -> s -> (a, s) Source
Runs a State
with the given initial state
and returns both the final value and the final state.
evalState :: proxy tag -> State tag s a -> s -> a Source
Runs a State
with the given initial state
and returns the final value, discarding the final state.
execState :: proxy tag -> State tag s a -> s -> s Source
Runs a State
with the given initial state
and returns the final state, discarding the final value.
The StateT monad transformer
type StateT tag s = TaggedTrans tag (StateT s) Source
stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a Source
Constructor for computations in the state monad transformer.
runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s) Source
Runs a StateT
with the given initial state
and returns both the final value and the final state.
evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a Source
Runs a StateT
with the given initial state
and returns the final value, discarding the final state.
execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s Source
Runs a StateT
with the given initial state
and returns the final state, discarding the final value.