Skip to main content
Module

x/fun/mod.ts>optics.of

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.of
import { optics } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { of } = 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.of(1);

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

Type Parameters

A
optional
S = unknown