Module Relude_RWST.WithMonad

Creates a RWST (Reader/Writer/State) Monad with the given Monad module.

Parameters

Signature

type t('a, 'r, 's, 'w) =
| RWST('r => 's => M.t(RWSResult.t('a's'w)))
;
let runRWST: a r s w. 'r => 's => t('a'r's'w) => M.t(RWSResult.t('a's'w));

Given a reader environment, and state, run the RWST to produce the monadic value.

let evalRWST: a r s w. 'r => 's => t('a'r's'w) => M.t(('a, 'w));

Same as runRWST, but discards the final state value, only returning the final result, and the writer log.

let execRWST: a r s w. 'r => 's => t('a'r's'w) => M.t(('s, 'w));

Same as runRWST, but discards the final result value, only returning the final state, and the writer log.

let mapRWST: a1 a2 r s w1 w2. (M.t(RWSResult.t('a1's'w1)) => M.t(RWSResult.t('a2's'w2))) => t('a1'r's'w1) => t('a2'r's'w2);

Change the result type and writer log type. Note: this should normally allow changing the monad, but we're not doing that for simplicity.

let withRWST: a r1 r2 s w. ('r2 => 's => ('r1, 's)) => t('a'r1's'w) => t('a'r2's'w);

Changes the reader environment and state values for an RWST using a function

let map: a b r s w. ('a => 'b) => t('a'r's'w) => t('b'r's'w);
let applyWithAppendLog: a b r s w. ('w => 'w => 'w) => t('a => 'b'r's'w) => t('a'r's'w) => t('b'r's'w);
let pureWithEmptyLog: a r s w. 'w => 'a => t('a'r's'w);
let bindWithAppendLog: a b r s w. ('w => 'w => 'w) => t('a'r's'w) => ('a => t('b'r's'w)) => t('b'r's'w);
module WithEnvAndStateAndLog: (R: BsBastet.Interface.TYPE) => (S: BsBastet.Interface.TYPE) => (Log: Relude_WriterT.WriterLog.LOG) => { ... };