Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>sortable.premap

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

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>