Skip to main content
Module

x/fun/mod.ts>fn.map

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

Map over the output of a Fn. This is equivalent to function composition. ie. a => pipe(f, map(g))(a) === a => g(f(a))

Examples

Example 1

import { map, wrap, pipe } from "./fn.ts";

const result = pipe(wrap(1), map(n => n + 1)); // 2

Parameters

fai: (a: A) => I

Returns

<D>(ta: Fn<D, A>) => Fn<D, I>