A monad containing an environment of type r, output of type w
and an updatable state of type s.
Moduletransformers-0.6.1.1Haskell2010
Control.Monad.Trans.RWS.CPS
A monad transformer that combines ReaderT, WriterT and StateT. This version uses continuation-passing-style for the writer part to achieve constant space usage. For a lazy version with the same interface, see Control.Monad.Trans.RWS.Lazy.
- 2 types
- 30 values
- Packagetransformers-0.6.1.1
- Exports32
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCPS.hs
The RWS monad
7 declarationsConstruct an RWS computation from a function. (The inverse of runRWS.)
Unwrap an RWS computation as a function. (The inverse of rws.)
evalRWS Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.
execRWS Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.
The RWST monad transformer
7 declarationsA monad transformer adding reading an environment of type r,
collecting an output of type w and updating a state of type s
to an inner monad m.
Instances11MonadTrans, Monad, Functor, MonadFix, MonadFail, Applicative, …
MonadTrans (RWST r w s)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSMonad m => Monad (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSFunctor m => Functor (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSMonadFix m => MonadFix (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSMonadFail m => MonadFail (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPS(Functor m, Monad m) => Applicative (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPS(Functor m, MonadPlus m) => Alternative (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPS(Functor m, MonadPlus m) => MonadPlus (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSMonadIO m => MonadIO (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPStype Rep (RWST r w s m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPS"RWST"
"Control.Monad.Trans.RWS.CPS"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"RWST"
'PrefixI 'True) (S1 ('MetaSel ('Just"unRWST"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (r -> s -> w -> m (a, s, w)))))
Construct an RWST computation from a function. (The inverse of runRWST.)
Unwrap an RWST computation as a function. (The inverse of rwsT.)
evalRWST Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.
execRWST Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.
Reader operations
4 declarationsConstructor for computations in the reader monad (equivalent to asks).
Fetch the value of the environment.
Writer operations
6 declarationsConstruct a writer computation from a (result, output) pair.
tell w is an action that produces the output w.
State operations
5 declarationsConstruct a state monad computation from a state transformer function.
Fetch the current value of the state within the monad.
put s sets the state within the monad to s.
Lifting other operations
3 declarationsUniform lifting of a callCC operation to the new monad.
This version rolls back to the original state on entering the
continuation.
In-situ lifting of a callCC operation to the new monad.
This version uses the current state on entering the continuation.
Lift a catchE operation to the new monad.