Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fun/predicate.ts>premap

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

Create a Predicate using a Predicate and a function that takes a type L and returns a type D. This maps over the input value of the predicate.

Examples

Example 1

import { premap } from "./predicate.ts";
import { pipe } from "./fn.ts";

const isGreaterThan3 = (n: number) => n > 3;
const isLongerThan3 = pipe(
  isGreaterThan3,
  premap((s: string) => s.length),
);

const result1 = isLongerThan3("Hello"); // true
const result2 = isLongerThan3("Hi"); // false

Parameters

fia: (i: I) => A