Module

Uncurried.RWSET

Package
purescript-uncurried-transformers
Repository
PureFunctor/purescript-uncurried-transformers

This module defines the reader-writer-state-error monad transformer, RWSET.

#RWSET Source

newtype RWSET :: Type -> Type -> Type -> Type -> (Type -> Type) -> Type -> Typenewtype RWSET r w s e m a

The reader-writer-state-error monad transformer, which combines the functionality of ReaderT, WriterT, StateT, and ExceptT into a single monad transformer.

Constructors

Instances

#rwseT Source

rwseT :: forall r w s e m a. Functor m => Monoid w => (r -> s -> m (s /\ (Either e a) /\ w)) -> RWSET r w s e m a

Create an RWSE monad from a function that takes the environment and the state, and returns a new state, an error or a result, and an accumulator.

#runRWSET Source

runRWSET :: forall r w s e m a. MonadRec m => r -> s -> RWSET r w s e m a -> m (s /\ (Either e a) /\ w)

Runs a computation inside of RWSET.

#evalRWSET Source

evalRWSET :: forall r w s e m a. MonadRec m => r -> s -> RWSET r w s e m a -> m ((Either e a) /\ w)

Runs a computation inside of RWSET, discarding the final state.

#execRWSET Source

execRWSET :: forall r w s e m a. MonadRec m => r -> s -> RWSET r w s e m a -> m (s /\ w)

Runs a computation inside of RWSET, discarding the final result.

#hoistRWSET Source

hoistRWSET :: forall r w s e m n a. (m ~> n) -> RWSET r w s e m a -> RWSET r w s e n a

Modifies the monadic context of a RWSET.

#mapRWSET Source

mapRWSET :: forall r w1 w2 s e m1 m2 a1 a2. MonadRec m1 => Functor m2 => (m1 (s /\ (Either e a1) /\ w1) -> m2 (s /\ (Either e a2) /\ w2)) -> RWSET r w1 s e m1 a1 -> RWSET r w2 s e m2 a2

Modifies the result and accumulator types of a RWSET.

#withRWSET Source

withRWSET :: forall r1 r2 w s e m a. (r2 -> s -> r1 /\ s) -> RWSET r1 w s e m a -> RWSET r2 w s e m a

Modifies the environment type of a RWSET.