import * as fun from "https://raw.githubusercontent.com/baetheus/fun/main/state.ts";
The State module contains the State structure. The purpose of State is to have modifiable date in an immutable workflow. This structure must preserve purity, so that subsequent executions of a state workflow with the same initial conditions produce the exact same results.
ApplicableState | |
bind | |
bindTo | |
FlatmappableState | The canonical implementation of Flatmappable for State. It contains the methods wrap, apply, map, join, and flatmap. |
MappableState | |
tap | |
WrappableState |
apply | Apply the A value of State<E, A> to the (a: A) => I value of State<E, (a: A) => I>, producing a State<E, I>. |
evaluate | Extract the result value A by executing State<S, A> with an S value. |
execute | Extract the ending state value S by executing State<S, A> with an S value. |
flatmap | Pass the A value in a State<S, A> into a function (a: A) => State<S, I>. This results in a new State<S, I>. |
getCombinableState | |
getInitializableState | |
gets | Construct a State<E, A> from a function E => A. |
id | An instance of Id that makes the State structure a Category. This is often used at the beginning of a State workflow to specify the type of data within a State structure. |
map | Map over the covariant value A in State<E, A>. |
modify | Construct a State<E, void> from a function E => E. |
put | Construct a State<E, void> from a static state value E. |
state | Construct a trivial State<E, A> from values E and A. |
wrap | Construct a State<E, A> from a static value A. |