import { type state } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { state } = state;
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.
Properties
readonly
kind: State<InOut<this, 1>, Out<this, 0>>import { type state } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { state } = 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.
import { state } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { state } = state;
The canonical implementation of Monad for State. It contains the methods of, ap, map, join, and chain.
import { state } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { state } = state;
Construct a trivial State<E, A> from values E and A.
Examples
Example 1
Example 1
import * as S from "./state.ts";
const state = S.state(1, 2);
const result = state(10); // [2, 1]