Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fun/pair.ts>reduce

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 reduce
import { reduce } from "https://deno.land/x/fun@v2.0.0-alpha.10/pair.ts";

Reduces a pair with an initial value, also passing the second value into the reducer as well.

Examples

Example 1

import { pair, reduce } from "./pair.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  pair(10, 20),
  reduce(Math.max, Number.NEGATIVE_INFINITY),
); // 20

Parameters

foao: (
acc: O,
first: A,
second: B,
) => O
initial: O

Returns

(ua: Pair<A, B>) => O