Module
Uncurried.StateT
- Package
- purescript-uncurried-transformers
- Repository
- PureFunctor/purescript-uncurried-transformers
This module defines the state monad transformer, StateT
.
#StateT Source
newtype StateT :: Type -> (Type -> Type) -> Type -> Type
newtype StateT s m a
The state monad transformer, implemented as a newtype over
RWSET
. Note that it's not recommended to stack newtypes of
RWSET
together as it incurs an indeterminate performance
penalty that would otherwise be solved by just using RWSET
.
Constructors
Instances
Functor (StateT s m)
Apply (StateT s m)
Applicative (StateT s m)
Bind (StateT s m)
Monad (StateT s m)
(MonadEffect m) => MonadEffect (StateT s m)
MonadRec (StateT s m)
MonadState s (StateT s m)
MonadTrans (StateT s)
(Semigroup a) => Semigroup (StateT s m a)
(Monoid a) => Monoid (StateT s m a)
Lazy (StateT s m a)
(MonadAsk r m) => MonadAsk r (StateT s m)
(MonadRec m, MonadReader r m) => MonadReader r (StateT s m)
(Monoid w, MonadTell w m) => MonadTell w (StateT s m)
(Monoid w, MonadRec m, MonadWriter w m) => MonadWriter w (StateT s m)
(MonadThrow e m) => MonadThrow e (StateT s m)
(MonadRec m, MonadError e m) => MonadError e (StateT s m)
#evalStateT Source
evalStateT :: forall s m a. MonadRec m => s -> StateT s m a -> m a
Runs a computation inside of StateT
, discarding the final state.
#execStateT Source
execStateT :: forall s m a. MonadRec m => s -> StateT s m a -> m s
Runs a computation inside of StateT
, discarding the final result.
#hoistStateT Source
hoistStateT :: forall s m n a. (m ~> n) -> StateT s m a -> StateT s n a
Modifies the monadic context of a StateT
.
#withStateT Source
withStateT :: forall s m a. (s -> s) -> StateT s m a -> StateT s m a
Modifies the state of a StateT
.