Idris2Doc : Control.Monad.RWS.CPS

Control.Monad.RWS.CPS

Note: The difference to a 'strict' RWST implementation is
that accumulation of values does not happen in the
Applicative and Monad instances but when invoking `Writer`-specific
functions like `writer` or `listen`.

Definitions

record RWST : Type -> Type -> Type -> (Type -> Type) -> Type -> Type
  A monad transformer extending an inner monad `m` with the ability to read
an environment of type `r`, collect an output of type `w` and update a
state of type `s`.

This is equivalent to `ReaderT r (WriterT w (StateT s m)) a`, but fuses the
three layers.

Totality: total
Visibility: public export
Constructor: 
MkRWST : (r -> s -> w -> m (a, (s, w))) -> RWST r w s m a

Projection: 
.unRWST : RWST r w s m a -> r -> s -> w -> m (a, (s, w))

Hints:
(Monad m, Alternative m) => Alternative (RWST r w s m)
Monad m => Applicative (RWST r w s m)
Functor m => Functor (RWST r w s m)
HasIO m => HasIO (RWST r w s m)
Monad m => Monad (RWST r w s m)
MonadError e m => MonadError e (RWST r w s m)
(Monoid w, Monad m) => MonadRWS r w s (RWST r w s m)
Monad m => MonadReader r (RWST r w s m)
Monad m => MonadState s (RWST r w s m)
MonadTrans (RWST r w s)
(Monoid w, Monad m) => MonadWriter w (RWST r w s m)
.unRWST : RWST r w s m a -> r -> s -> w -> m (a, (s, w))
Totality: total
Visibility: public export
unRWST : RWST r w s m a -> r -> s -> w -> m (a, (s, w))
Totality: total
Visibility: public export
runRWST : Monoid w => r -> s -> RWST r w s m a -> m (a, (s, w))
  Unwrap an RWST computation as a function.

This is the inverse of `rwsT`.

Totality: total
Visibility: public export
rwsT : Semigroup w => Functor m => (r -> s -> m (a, (s, w))) -> RWST r w s m a
  Construct an RWST computation from a function.

This is the inverse of `runRWST`.

Totality: total
Visibility: public export
evalRWST : Monoid w => Functor m => r -> s -> RWST r w s m a -> m (a, w)
  Evaluate a computation with the given initial state and environment,
returning the final value and output, discarding the final state.

Totality: total
Visibility: public export
execRWST : Monoid w => Functor m => r -> s -> RWST r w s m a -> m (s, w)
  Evaluate a computation with the given initial state and environment,
returning the final state and output, discarding the final value.

Totality: total
Visibility: public export
mapRWST : (Functor n, (Monoid w, Semigroup w')) => (m (a, (s, w)) -> n (b, (s, w'))) -> RWST r w s m a -> RWST r w' s n b
  Map over the inner computation.

Totality: total
Visibility: public export
withRWST : (r' -> s -> (r, s)) -> RWST r w s m a -> RWST r' w s m a
  `withRWST f m` executes action `m` with an initial environment
and state modified by applying `f`.

Totality: total
Visibility: public export
RWS : Type -> Type -> Type -> Type -> Type
  A monad containing an environment of type `r`, output of type `w`
and an updatable state of type `s`.

This is `RWST` applied to `Identity`.

Totality: total
Visibility: public export
runRWS : Monoid w => r -> s -> RWS r w s a -> (a, (s, w))
  Unwrap an RWS computation as a function.

This is the inverse of `rws`.

Totality: total
Visibility: public export
rws : Semigroup w => (r -> s -> (a, (s, w))) -> RWS r w s a
  Construct an RWS computation from a function.

This is the inverse of `runRWS`.

Totality: total
Visibility: public export
evalRWS : Monoid w => r -> s -> RWS r w s a -> (a, w)
  Evaluate a computation with the given initial state and environment,
returning the final value and output, discarding the final state.

Totality: total
Visibility: public export
execRWS : Monoid w => r -> s -> RWS r w s a -> (s, w)
  Evaluate a computation with the given initial state and environment,
returning the final state and output, discarding the final value.

Totality: total
Visibility: public export
mapRWS : (Monoid w, Semigroup w') => ((a, (s, w)) -> (b, (s, w'))) -> RWS r w s a -> RWS r w' s b
  Map the return value, final state and output of a computation using
the given function.

Totality: total
Visibility: public export
withRWS : (r' -> s -> (r, s)) -> RWS r w s a -> RWS r' w s a
  `withRWS f m` executes action `m` with an initial environment
and state modified by applying `f`.

Totality: total
Visibility: public export