Skip to main content
Module

x/fun/mod.ts>optic.AffineFold

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
type alias optic.AffineFold
import { type optic } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { AffineFold } = optic;

AffineFold<S, A> is an alias of Optic<AffineTag, S, A>. This means the view function of an AffineFold returns an Option, (s: S) => Option<A>. Some example AffineFolds are accessing a value at an index in an array, accessing the value in an Option, and accessing a key in a Record type. In general, an AffineFold is used for focusing on zero or one value A contained in the value S.