import * as fun from "https://deno.land/x/fun@v2.0.0/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.
Variables
v bind | |
The canonical implementation of Flatmappable for State. It contains the methods wrap, apply, map, join, and flatmap. | |
v tap | |
Functions
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>. | |
Extract the result value A by executing State<S, A> with an S value. | |
Extract the ending state value S by executing State<S, A> with an S value. | |
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>. | |
f gets | Construct a State<E, A> from a function E => A. |
f 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. |
f map | Map over the covariant value A in State<E, A>. |
Construct a State<E, void> from a function E => E. | |
f put | Construct a State<E, void> from a static state value E. |
Construct a trivial State<E, A> from values E and A. | |
f wrap | Construct a State<E, A> from a static value A. |
Interfaces
Specifies State as a Higher Kinded Type, with covariant parameter A in the 0th index of any substitutions and invariant parameter E in the 0th parameter of any substitutions. |
Type Aliases
The State<E, A> type represents the core State structure. The input/output variable E is invariant, and the output variable A is covariant. |