Skip to main content
Module

x/fun/mod.ts>optics.Viewer

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
interface optics.Viewer
import { type optics } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { Viewer } = optics;

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]>