Skip to main content
Module

x/fun/mod.ts>optic.wrap

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

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