Copyright | (c) Ivan Lazar Miljenovic |
---|---|
License | 3-Clause BSD-style |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Monad environments for stateful computations.
- state :: forall m s a. HasState s m => (s -> (a, s)) -> m a
- get :: HasState s m => m s
- gets :: HasState s m => (s -> a) -> m a
- put :: HasState s m => s -> m ()
- modify :: HasState s m => (s -> s) -> m ()
- modify' :: HasState s m => (s -> s) -> m ()
- type HasState s m = SatisfyConstraint (IsState s) m
- class MonadTower m => IsState s m
Documentation
state :: forall m s a. HasState s m => (s -> (a, s)) -> m a Source
Embed a simple state action into the monad stack.
gets :: HasState s m => (s -> a) -> m a Source
Apply a function to the stateful environment. Equivalent to
fmap f
.get
modify' :: HasState s m => (s -> s) -> m () Source
A variant of modify
in which the computation is strict in the
new state.
type HasState s m = SatisfyConstraint (IsState s) m Source
A monad stack containing a stateful environment of type s
.
class MonadTower m => IsState s m Source
The minimal definition needed for a monad providing a stateful environment.
MonadTower m => IsState s (StateT s m) | |
MonadTower m => IsState s (StateT s m) | |
(MonadTower m, Monoid w) => IsState s (RWST r w s m) | |
(MonadTower m, Monoid w) => IsState s (RWST r w s m) | |
ValidConstraint (IsState s) | |
MonadTower m => ConstraintPassThrough (IsState s) (ListT m) True | |
MonadTower m => ConstraintPassThrough (IsState s) (ContT r m) True | |
type ConstraintSatisfied (IsState s) m |