import { default } from "https://deno.land/x/functional@v1.3.4/mod.ts";
import { default } from "https://deno.land/x/functional@v1.3.4/mod.ts";
Pair
The Pair
type represents two values.
The Pair
type implements the following algebras:
- [x] Bifunctor
- [x] Functor
Example
import Pair from "https://deno.land/x/functional@v1.3.2/library/Pair.js";
const pair = Pair(42, 42)
.bimap(
x => x * 2,
x => x + 2
);
assert(Pair.is(pair));
assert(pair.first === 84);
assert(pair.first === 44);