Skip to main content
Module

x/fun/mod.ts>optics.composeReviewer

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

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

Examples

Example 1

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

const set = <A>() => O.refold<ReadonlySet<A>, A>(
  Array.from,
  S.of,
  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>