A monad containing an environment of type r, output of type w
and an updatable state of type s.
Modulererebase-1.21.2Haskell2010
Control.Monad.Trans.RWS
- 2 types
- 28 values
- Packagererebase-1.21.2
- Exports30
- LanguageHaskell2010
- LicenceMIT
- SourceLazy.hs
Uniform lifting of a callCC operation to the new monad.
This version rolls back to the original state on entering the
continuation.
Fetch the value of the environment.
Constructor for computations in the reader monad (equivalent to asks).
Fetch the current value of the state within the monad.
put s sets the state within the monad to s.
Construct a state monad computation from a state transformer function.
tell w is an action that produces the output w.
Construct a writer computation from a (result, output) pair.
A 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.
Instances40MonadRWS, MonadAccum, MonadError, MonadReader, MonadState, MonadWriter, …
(Monoid w, Monad m) => MonadRWS r w s (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.RWS.Class(MonadAccum w' m, Monoid w) => MonadAccum w' (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.Accum(Monoid w, MonadError e m) => MonadError e (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.Error.Class(Monad m, Monoid w) => MonadReader r (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.Reader.Class(Monad m, Monoid w) => MonadState s (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.State.Class(Monoid w, Monad m) => MonadWriter w (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.Writer.Class(MonadSelect w' m, Monoid w) => MonadSelect w' (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.SelectA combination of an 'outer' ReaderT,
WriterTandStateT. In short, you get a value of typerwhich can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to ansand aw, but can modify neither.(Monoid w, MonadBase b m) => MonadBase b (RWST r w s m)Defined in transformers-base-0.4.6 · Control.Monad.Base(Functor f, MonadFree f m, Monoid w) => MonadFree f (RWST r w s m)Defined in free-5.2 · Control.Monad.Free.ClassMonoid w => MonadTrans (RWST r w s)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.LazyMonoid w => BindTrans (RWST r w s)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.Trans(Monoid w, Monad m) => Monad (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.LazyFunctor m => Functor (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, MonadFix m) => MonadFix (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, MonadFail m) => MonadFail (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, MonadPlus m) => MonadPlus (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, MonadIO m) => MonadIO (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.LazyContravariant m => Contravariant (RWST r w s m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(Monoid w, MonadCont m) => MonadCont (RWST r w s m)Defined in mtl-2.3.1 · Control.Monad.Cont.Class(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m)Defined in exceptions-0.10.9 · Control.Monad.Catch(MonadMask m, Monoid w) => MonadMask (RWST r w s m)Defined in exceptions-0.10.9 · Control.Monad.Catch(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m)Defined in exceptions-0.10.9 · Control.Monad.Catch(Monoid w, PrimMonad m) => PrimMonad (RWST r w s m)Defined in primitive-0.9.1.0 · Control.Monad.PrimitiveDecidable m => Decidable (RWST r w s m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleDivisible m => Divisible (RWST r w s m)Defined in contravariant-1.5.5 · Data.Functor.Contravariant.DivisibleAlt f => Alt (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.Alt(Bind m, Semigroup w) => Apply (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassAn
RWST r w s mis not Applicative unless itswis a Monoid, but it is an instance of Apply(Bind m, Semigroup w) => Bind (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Bind.ClassConclude m => Conclude (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.ConcludeDecide m => Decide (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DecideDivise m => Divise (RWST r w s m)Defined in semigroupoids-6.0.1 · Data.Functor.Contravariant.DivisePlus f => Plus (RWST r w s f)Defined in semigroupoids-6.0.1 · Data.Functor.PlusInvariant m => Invariant (RWST r w s m)Defined in invariant-0.6.4 · Data.Functor.Invariantfrom the
transformerspackage(Monoid w, Monad m) => Selective (RWST r w s m)Defined in selective-0.7.0.1 · Control.Selective(Default w, Pointed m) => Pointed (RWST r w s m)Defined in pointed-5.0.4 · Data.PointedGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazytype Rep (RWST r w s m a) = D1 ('MetaDataDefined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy"RWST"
"Control.Monad.Trans.RWS.Lazy"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons"RWST"
'PrefixI 'True) (S1 ('MetaSel ('Just"runRWST"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (r -> s -> m (a, s, w)))))type PrimState (RWST r w s m) = PrimState mDefined in primitive-0.9.1.0 · Control.Monad.Primitive
Lift a catchE operation to the new monad.
In-situ lifting of a callCC operation to the new monad.
This version uses the current state on entering the continuation.
evalRWS :: RWS r w s aRWS computation to execute
-> rinitial environment
-> sinitial value
-> (a, w)final value and output
Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.
evalRWST Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.
execRWS :: RWS r w s aRWS computation to execute
-> rinitial environment
-> sinitial value
-> (s, w)final state and output
Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.
execRWST Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.
Unwrap an RWS computation as a function. (The inverse of rws.)
Construct an RWS computation from a function. (The inverse of runRWS.)