Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>optic.Viewer

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

A Viewer<T, S, A> implements a view function (s: S) => T<A>. This is effectively a Kliesli Arrow. The valid types of T are Identity, Option, and Array. Viewer also includes a runtime tag corresponding to the return type of the view function to aid in composition.

Type Parameters

T extends Tag
S
A

Properties

readonly
tag: T
readonly
view: (s: S) => $<ToKind<T>, [A, never, never]>