Skip to main content
Module

x/fun/sortable.ts

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

Functions

Construct an exclusive between function over A from Sortable.

Construct an inclusive clamp function over A from Sortable.

Create a Sortable from a curried Sort.

Derives an Sortable from a Compare function.

Construct a curried greater than function over A from Sortable.

Construct a curried greater than or equal to function over A from Sortable.

Construct a curried less than function over A from Sortable.

Construct a curried less than or equal to function over A from Sortable.

Construct a maximum function over A from Sortable.

Construct a minimum function over A from 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.

Derive an Sortable with the reverse ordering of an existing Sortable.

Returns an Ordering from any number according to its relationship with 0.

Derives an Sortable from a structs of Sortables. The derived Sortable will compare two structs starting with the first defined key and return the first ordering that is non-zero, otherwise the two structs are equal.

Create a trivial Sortable, where all values of A are considered equal.

Derives an Sortable from a tuple of Sortables. The derived Sortable will compare two tuples starting at index 0 and return the first ordering that is non-zero, otherwise the two tuples are equal.

Interfaces

Specifies Sortable as a Higher Kinded Type, with contravariant parameter D corresponding to the 0th index of any Substitutions.

A Sortable structure has the method sort.

Type Aliases

The ordering type is the expected output of any Compare function. The canonical example is the output of the Array.sort function. For any two values first and second, Ordering means the following:

The Sort function takes to values of the same type and returns an ordering, indicating whether first is less than, equal to, or greater than `second. See Ordering for the order.