Skip to main content
Module

x/fun/mod.ts>pair.merge

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

Apply a function in the first position of a pair to a value in the second position of a pair.

Examples

Example 1

import * as P from "./pair.ts";
import { flow } from "./fn.ts";

const double = flow(
  P.dup<number>,
  P.map(n => (m: number) => n + m),
  P.merge,
);

const result1 = double(1); // 2
const result2 = double(2); // 4

Parameters

ua: Pair<(a: A) => I, A>