Skip to main content
Module

x/fun/record.ts>collapse

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

Collect all values in a ReadonlyRecord into a single value I by using a Combinable. This is effectively fold using a Combinable for the initial value and combination.

Examples

Example 1

import * as R from "./record.ts";
import { InitializableNumberSum } from "./number.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  { one: 1, two: 2, three: 3 },
  R.collapse(InitializableNumberSum),
); // 6