Skip to main content
Module

x/fun/optics.ts>optic

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function optic
import { optic } from "https://deno.land/x/fun@v2.0.0-alpha.12/optics.ts";

Construct an Optic<U, S, A> & Reviewer<S, A> from a tag as well as view, modify, and reivew functions.

Type Parameters

U extends Tag
S
A

Parameters

tag: U
view: (s: S) => $<ToKind<U>, [A, never, never]>
modify: (modifyFn: (a: A) => A) => (s: S) => S
review: (a: A) => S

Construct an Optic<U, S, A> from a tag as well as view and modify functions.

Type Parameters

U extends Tag
S
A

Parameters

tag: U
view: (s: S) => $<ToKind<U>, [A, never, never]>
modify: (modifyFn: (a: A) => A) => (s: S) => S