import { optic } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { id } = optic;
Construct an Iso<A, A> from a type level argument. This is the entrypoint to almost all optics as it allows one to start with a type and compose other optics from there.
Examples
Example 1
Example 1
import * as O from "./optic.ts";
const number = O.id<number>();
const result1 = number.view(1); // 1
const result2 = number.review(1); // 1
const result4 = number.modify(n => n + 1)(1); // 2