Skip to main content
Module

x/fun/sortable.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/sortable.ts";

Derives an instance of Sortable by take an existing Sortable over D and a function that turns an L into D and returns an Sortable over L.

Examples

Example 1

import { premap } from "./sortable.ts";
import { SortableNumber } from "./number.ts";
import { pipe } from "./fn.ts";

// Use number ordering, turn date into number and premap
const date = pipe(
  SortableNumber,
  premap((d: Date) => d.valueOf()),
);

Parameters

fld: (l: L) => D

Returns

(unnamed 0: Sortable<D>) => Sortable<L>