Skip to main content
Module

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

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>