Control.Monad.RWS
- Package
- purescript-transformers
- Repository
- purescript/purescript-transformers
This module defines the RWS
monad.
Re-exports from Control.Monad.RWS.Trans
#RWST Source
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)
#MonadTrans Source
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
Re-exports from Control.Monad.Reader.Class
#local Source
local :: forall r m a. MonadReader r m => (r -> r) -> m a -> m a
Re-exports from Control.Monad.State.Class
#state Source
state :: forall s m a. MonadState s m => (s -> (Tuple a s)) -> m a
#put Source
put :: forall s m. MonadState s m => s -> m Unit
Set the state.
#modify_ Source
modify_ :: forall m s. MonadState s m => (s -> s) -> m Unit
#modify Source
modify :: forall m s. 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 Source
gets :: forall a m s. MonadState s m => (s -> a) -> m a
Get a value which depends on the current state.
#get Source
get :: forall s m. MonadState s m => m s
Get the current state.
Re-exports from Control.Monad.Writer.Class
#listen Source
listen :: forall w m a. MonadWriter w m => m a -> m (Tuple a w)
#pass Source
pass :: forall w m a. MonadWriter w m => m (Tuple a (w -> w)) -> m a
#listens Source
listens :: forall b a m w. MonadWriter w m => (w -> b) -> m a -> m (Tuple a b)
Projects a value from modifications made to the accumulator during an action.
#censor Source
censor :: forall a m w. MonadWriter w m => (w -> w) -> m a -> m a
Modify the final accumulator value by applying a function.
- Modules
- 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.
Monad. Cont - Control.
Monad. Cont. Class - Control.
Monad. Cont. Trans - Control.
Monad. Error. Class - Control.
Monad. Except - Control.
Monad. Except. Trans - Control.
Monad. List. Trans - Control.
Monad. Maybe. Trans - Control.
Monad. RWS - Control.
Monad. RWS. Trans - Control.
Monad. Reader - Control.
Monad. Reader. Class - Control.
Monad. Reader. Trans - Control.
Monad. State - Control.
Monad. State. Class - Control.
Monad. State. Trans - Control.
Monad. Trans. Class - Control.
Monad. Writer - Control.
Monad. Writer. Class - Control.
Monad. Writer. Trans