Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

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.

§Variables

ApplicableState
bind
bindTo
FlatmappableState

The canonical implementation of Flatmappable for State. It contains the methods wrap, apply, map, join, and flatmap.

MappableState
tap
WrappableState

§Functions

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.

§Interfaces

KindState

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

State

The State<E, A> type represents the core State structure. The input/output variable E is invariant, and the output variable A is covariant.