Module

Uncurried.RWSE

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

This module defines the RWSE monad.

#RWSE Source

type RWSE r w s e = RWSET r w s e Identity

A type synonym for a RWSET with Identity as its base monad.

#rwse Source

rwse :: forall r w s e a. Monoid w => (r -> s -> (s /\ (Either e a) /\ w)) -> RWSE r w s e 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.

#runRWSE Source

runRWSE :: forall r w s e a. Monoid w => r -> s -> RWSE r w s e a -> (s /\ (Either e a) /\ w)

Runs a computation inside of RWSE.

#evalRWSE Source

evalRWSE :: forall r w s e a. Monoid w => r -> s -> RWSE r w s e a -> ((Either e a) /\ w)

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

#execRWSE Source

execRWSE :: forall r w s e a. Monoid w => r -> s -> RWSE r w s e a -> (s /\ w)

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

#mapRWSE Source

mapRWSE :: forall r w1 w2 s e a b. ((s /\ (Either e a) /\ w1) -> (s /\ (Either e b) /\ w2)) -> RWSE r w1 s e a -> RWSE r w2 s e b

Modifies the result and accumulator types of a RWSE.

#withRWSE Source

withRWSE :: forall r1 r2 w s e a. (r2 -> s -> r1 /\ s) -> RWSE r1 w s e a -> RWSE r2 w s e a

Modifies the environment type of a RWSE.