A monad containing an environment of type r, output of type w
and an updatable state of type s.
Modulemtl-2.3.1Haskell2010
Control.Monad.RWS.Lazy
Lazy RWS monad.
Inspired by the paper Functional Programming with Overloading and Higher-Order Polymorphism, Mark P Jones (http://web.cecs.pdx.edu/~mpj/) Advanced School of Functional Programming, 1995.
- 2 types
- 11 values
- Packagemtl-2.3.1
- Exports13
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceLazy.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 :: 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.
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.
The RWST monad transformer
6 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.
Instances20MonadRWS, 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 => MonadTrans (RWST r w s)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.Lazy(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.ClassGeneric (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)))))
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.
Lazy Reader-writer-state monads
0 declarationsmodule Control.Monad.RWS.Class
module Control.Monad.Trans