Skip to main content
Module

x/fun/pair.ts>extend

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

Creates a new pair by constructing a first value from the whole pair and keeping the second value from the original pair. Can be used somewhat like a superpowered Reader.

Examples

Example 1

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

const result = pipe(
  pair("Brandon", 37),
  extend(([name, age]) => `${name} is ${age}`)
); // ["Brandon is 37", 37];

Parameters

ftai: (ua: Pair<A, B>) => I

Returns

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