Control.Monad.RWS
This module defines the RWS
monad.
#RWS
#rws
#runRWS
#evalRWS
#execRWS
#mapRWS
#withRWS
Re-exports from Control.Monad.RWS.Trans
#RWST
newtype RWST :: Type -> Type -> Type -> (Type -> Type) -> Type -> Type
newtype RWST r w s m a
The reader-writer-state monad transformer, which combines the operations
of ReaderT
, WriterT
and StateT
into a single monad transformer.
Constructors
Instances
Newtype (RWST r w s m a) _
(Functor m) => Functor (RWST r w s m)
(Bind m, Monoid w) => Apply (RWST r w s m)
(Alt m) => Alt (RWST r w s m)
(Monoid w, Alternative m, Monad m) => Alternative (RWST r w s m)
(Bind m, Monoid w) => Bind (RWST r w s m)
(Monad m, Monoid w) => Applicative (RWST r w s m)
(Monad m, Monoid w) => Monad (RWST r w s m)
(Monoid w) => MonadTrans (RWST r w s)
Lazy (RWST r w s m a)
(Monoid w, MonadEffect m) => MonadEffect (RWST r w s m)
(Monad m, Monoid w) => MonadAsk r (RWST r w s m)
(Monad m, Monoid w) => MonadReader r (RWST r w s m)
(Monad m, Monoid w) => MonadState s (RWST r w s m)
(Monad m, Monoid w) => MonadTell w (RWST r w s m)
(Monad m, Monoid w) => MonadWriter w (RWST r w s m)
(MonadThrow e m, Monoid w) => MonadThrow e (RWST r w s m)
(MonadError e m, Monoid w) => MonadError e (RWST r w s m)
(MonadRec m, Monoid w) => MonadRec (RWST r w s m)
(Plus m) => Plus (RWST r w s m)
(Bind m, Monoid w, Semigroup a) => Semigroup (RWST r w s m a)
(Monad m, Monoid w, Monoid a) => Monoid (RWST r w s m a)
#MonadTrans
class MonadTrans :: ((Type -> Type) -> Type -> Type) -> Constraint
class MonadTrans t where
The MonadTrans
type class represents monad transformers.
A monad transformer is a type constructor of kind (* -> *) -> * -> *
, which
takes a Monad
as its first argument, and returns another Monad
.
This allows us to add additional effects to an existing monad. By iterating this process, we create monad transformer stacks, which contain all of the effects required for a particular computation.
The laws state that lift
is a Monad
morphism.
Laws:
lift (pure a) = pure a
lift (do { x <- m ; y }) = do { x <- lift m ; lift y }
Members
#withRWST
#runRWST
#mapRWST
#execRWST
#evalRWST
Re-exports from Control.Monad.Reader.Class
#local
local :: forall m r a. MonadReader r m => (r -> r) -> m a -> m a
#asks
Re-exports from Control.Monad.State.Class
#state
state :: forall m s a. MonadState s m => (s -> (Tuple a s)) -> m a
#put
put :: forall m s. MonadState s m => s -> m Unit
Set the state.
#modify_
modify_ :: forall s m. MonadState s m => (s -> s) -> m Unit
#modify
modify :: forall s m. MonadState s m => (s -> s) -> m s
Modify the state by applying a function to the current state. The returned value is the new state value.
#gets
gets :: forall s m a. MonadState s m => (s -> a) -> m a
Get a value which depends on the current state.
#get
get :: forall m s. MonadState s m => m s
Get the current state.
Re-exports from Control.Monad.Writer.Class
#listen
listen :: forall m w a. MonadWriter w m => m a -> m (Tuple a w)
#pass
pass :: forall m w a. MonadWriter w m => m (Tuple a (w -> w)) -> m a
#listens
listens :: forall w m a b. MonadWriter w m => (w -> b) -> m a -> m (Tuple a b)
Projects a value from modifications made to the accumulator during an action.
#censor
censor :: forall w m a. MonadWriter w m => (w -> w) -> m a -> m a
Modify the final accumulator value by applying a function.
Modules
- Ansi.Codes
- Ansi.Output
- Ch5
- Ch6
- Ch7a
- Ch7b
- Ch9
- Control.Alt
- Control.Alternative
- Control.Applicative
- Control.Apply
- Control.Biapplicative
- Control.Biapply
- Control.Bind
- Control.Category
- Control.Comonad
- Control.Comonad.Cofree
- Control.Comonad.Cofree.Class
- Control.Comonad.Env
- Control.Comonad.Env.Class
- Control.Comonad.Env.Trans
- Control.Comonad.Store
- Control.Comonad.Store.Class
- Control.Comonad.Store.Trans
- Control.Comonad.Traced
- Control.Comonad.Traced.Class
- Control.Comonad.Traced.Trans
- Control.Comonad.Trans.Class
- Control.Extend
- Control.Lazy
- Control.Monad
- Control.Monad.Cont
- Control.Monad.Cont.Class
- Control.Monad.Cont.Trans
- Control.Monad.Error.Class
- Control.Monad.Except
- Control.Monad.Except.Trans
- Control.Monad.Fork.Class
- Control.Monad.Free
- Control.Monad.Free.Class
- Control.Monad.Gen
- Control.Monad.Gen.Class
- Control.Monad.Gen.Common
- Control.Monad.Identity.Trans
- Control.Monad.List.Trans
- Control.Monad.Maybe.Trans
- Control.Monad.Morph
- Control.Monad.RWS
- Control.Monad.RWS.Trans
- Control.Monad.Reader
- Control.Monad.Reader.Class
- Control.Monad.Reader.Trans
- Control.Monad.Rec.Class
- Control.Monad.ST
- Control.Monad.ST.Class
- Control.Monad.ST.Global
- Control.Monad.ST.Internal
- Control.Monad.ST.Ref
- Control.Monad.State
- Control.Monad.State.Class
- Control.Monad.State.Trans
- Control.Monad.Trampoline
- Control.Monad.Trans.Class
- Control.Monad.Writer
- Control.Monad.Writer.Class
- Control.Monad.Writer.Trans
- Control.MonadPlus
- Control.MonadZero
- Control.Parallel
- Control.Parallel.Class
- Control.Plus
- Control.Semigroupoid
- Data.Array
- Data.Array.NonEmpty
- Data.Array.NonEmpty.Internal
- Data.Array.Partial
- Data.Array.ST
- Data.Array.ST.Iterator
- Data.Array.ST.Partial
- Data.Bifoldable
- Data.Bifunctor
- Data.Bifunctor.Join
- Data.Bitraversable
- Data.Boolean
- Data.BooleanAlgebra
- Data.Bounded
- Data.Bounded.Generic
- Data.CatList
- Data.CatQueue
- Data.Char
- Data.Char.Gen
- Data.CommutativeRing
- Data.Comparison
- Data.Const
- Data.Coyoneda
- Data.Date
- Data.Date.Component
- Data.Date.Component.Gen
- Data.Date.Gen
- Data.DateTime
- Data.DateTime.Gen
- Data.DateTime.Instant
- Data.Decidable
- Data.Decide
- Data.Distributive
- Data.Divide
- Data.Divisible
- Data.DivisionRing
- Data.Either
- Data.Either.Inject
- Data.Either.Nested
- Data.Enum
- Data.Enum.Gen
- Data.Enum.Generic
- Data.Eq
- Data.Eq.Generic
- Data.Equivalence
- Data.EuclideanRing
- Data.Exists
- Data.Field
- Data.Foldable
- Data.FoldableWithIndex
- Data.Function
- Data.Function.Uncurried
- Data.Functor
- Data.Functor.App
- Data.Functor.Clown
- Data.Functor.Compose
- Data.Functor.Contravariant
- Data.Functor.Coproduct
- Data.Functor.Coproduct.Inject
- Data.Functor.Coproduct.Nested
- Data.Functor.Costar
- Data.Functor.Flip
- Data.Functor.Invariant
- Data.Functor.Joker
- Data.Functor.Product
- Data.Functor.Product.Nested
- Data.Functor.Product2
- Data.FunctorWithIndex
- Data.Generic.Rep
- Data.HeytingAlgebra
- Data.HeytingAlgebra.Generic
- Data.Identity
- Data.Int
- Data.Int.Bits
- Data.Interval
- Data.Interval.Duration
- Data.Interval.Duration.Iso
- Data.Lazy
- Data.List
- Data.List.Internal
- Data.List.Lazy
- Data.List.Lazy.NonEmpty
- Data.List.Lazy.Types
- Data.List.NonEmpty
- Data.List.Partial
- Data.List.Types
- Data.List.ZipList
- Data.Map
- Data.Map.Gen
- Data.Map.Internal
- Data.Maybe
- Data.Maybe.First
- Data.Maybe.Last
- Data.Monoid
- Data.Monoid.Additive
- Data.Monoid.Alternate
- Data.Monoid.Conj
- Data.Monoid.Disj
- Data.Monoid.Dual
- Data.Monoid.Endo
- Data.Monoid.Generic
- Data.Monoid.Multiplicative
- Data.NaturalTransformation
- Data.Newtype
- Data.NonEmpty
- Data.Number
- Data.Number.Approximate
- Data.Number.Format
- Data.Op
- Data.Ord
- Data.Ord.Down
- Data.Ord.Generic
- Data.Ord.Max
- Data.Ord.Min
- Data.Ordering
- Data.Predicate
- Data.Profunctor
- Data.Profunctor.Choice
- Data.Profunctor.Closed
- Data.Profunctor.Cochoice
- Data.Profunctor.Costrong
- Data.Profunctor.Join
- Data.Profunctor.Split
- Data.Profunctor.Star
- Data.Profunctor.Strong
- Data.Ring
- Data.Ring.Generic
- Data.Semigroup
- Data.Semigroup.First
- Data.Semigroup.Foldable
- Data.Semigroup.Generic
- Data.Semigroup.Last
- Data.Semigroup.Traversable
- Data.Semiring
- Data.Semiring.Generic
- Data.Set
- Data.Set.NonEmpty
- Data.Show
- Data.Show.Generic
- Data.String
- Data.String.CaseInsensitive
- Data.String.CodePoints
- Data.String.CodeUnits
- Data.String.Common
- Data.String.Gen
- Data.String.NonEmpty
- Data.String.NonEmpty.CaseInsensitive
- Data.String.NonEmpty.CodePoints
- Data.String.NonEmpty.CodeUnits
- Data.String.NonEmpty.Internal
- Data.String.Pattern
- Data.String.Regex
- Data.String.Regex.Flags
- Data.String.Regex.Unsafe
- Data.String.Unsafe
- Data.Symbol
- Data.Time
- Data.Time.Component
- Data.Time.Component.Gen
- Data.Time.Duration
- Data.Time.Duration.Gen
- Data.Time.Gen
- Data.Traversable
- Data.Traversable.Accum
- Data.Traversable.Accum.Internal
- Data.TraversableWithIndex
- Data.Tuple
- Data.Tuple.Nested
- Data.Unfoldable
- Data.Unfoldable1
- Data.Unit
- Data.Void
- Data.Yoneda
- Effect
- Effect.AVar
- Effect.Aff
- Effect.Aff.AVar
- Effect.Aff.Class
- Effect.Aff.Compat
- Effect.Class
- Effect.Class.Console
- Effect.Console
- Effect.Exception
- Effect.Exception.Unsafe
- Effect.Now
- Effect.Ref
- Effect.Uncurried
- Effect.Unsafe
- Main
- Math
- PSCI.Support
- Partial
- Partial.Unsafe
- Pipes
- Pipes.Core
- Pipes.Internal
- Pipes.ListT
- Pipes.Prelude
- Prelude
- Prim
- Prim.Boolean
- Prim.Coerce
- Prim.Ordering
- Prim.Row
- Prim.RowList
- Prim.Symbol
- Prim.TypeError
- Record.Unsafe
- Safe.Coerce
- Test.Main
- Test.Spec
- Test.Spec.Assertions
- Test.Spec.Assertions.String
- Test.Spec.Console
- Test.Spec.Reporter
- Test.Spec.Reporter.Base
- Test.Spec.Reporter.Console
- Test.Spec.Reporter.Dot
- Test.Spec.Reporter.Spec
- Test.Spec.Reporter.Tap
- Test.Spec.Result
- Test.Spec.Runner
- Test.Spec.Runner.Event
- Test.Spec.Speed
- Test.Spec.Style
- Test.Spec.Summary
- Test.Spec.Tree
- Type.Data.Row
- Type.Data.RowList
- Type.Equality
- Type.Proxy
- Unsafe.Coerce