Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>pair.bimap

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

Creates a new pair by mapping first through the fai function and second through the fbj function.

Examples

Example 1

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

const result = pipe(
  P.pair(1, 2),
  P.bimap(String, n => n + 1),
); // ['1', 3]

Parameters

fbj: (b: B) => J
fai: (a: A) => I

Returns

(ta: Pair<A, B>) => Pair<I, J>