Skip to main content
Module

x/fun/optic.ts>composeReviewer

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

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>