Skip to main content
Module

x/fun/mod.ts>optics.wrap

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 optics.wrap
import { optics } from "https://deno.land/x/fun@v2.0.0-alpha.12/mod.ts";
const { wrap } = optics;

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 "./optics.ts";

const viewer = O.wrap(1);

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

Type Parameters

A
optional
S = unknown