Skip to main content
Module

x/fun/optic.ts>wrap

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

Construct a Lens Viewer from a raw value A. The view function of this viewer operatates like constant(a).

Examples

Example 1

import * as O from "./optic.ts";

const viewer = O.wrap(1);

const result1 = viewer.view(2); // 1
const result2 = viewer.view(100); // 1

Type Parameters

A
optional
S = unknown