import { fn } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { contramap } = fn;
Map over the input of a function, turning D => A and L => D into L => A.
Examples
Example 1
Example 1
import { contramap, pipe } from "./fn.ts";
const equalsZero = (n: number): boolean => n === 0;
const strLength = (s: string): number => s.length;
const isEmpty = pipe(
equalsZero,
contramap(strLength),
);
const result1 = isEmpty(""); // true
const result2 = isEmpty("Hello"); // false