Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>optic.composeReviewer

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

Compose two reviewer functions, allowing one to create nested Reviewer structures.

Examples

Example 1

import * as O from "./optic.ts";
import * as S from "./set.ts";
import { pipe } from "./fn.ts";

const set = <A>() => O.refold<ReadonlySet<A>, A>(
  Array.from,
  S.wrap,
  S.map,
);

const sets = pipe(
  set<ReadonlySet<number>>(),
  O.composeReviewer(set()),
);

const result = sets.review(1); // Set(Set(1))

Returns

<S>(first: Reviewer<S, A>) => Reviewer<S, I>