Skip to main content
Module

x/fun/mod.ts>array.getSortableArray

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

Given an instance Sortable create a Sortable<ReadonlyArray>.

Examples

Example 1

import * as A from "./array.ts";
import { SortableNumber } from "./number.ts";

const { sort } = A.getSortableArray(SortableNumber);

const result1 = sort([1, 2], [1, 2]); // 0
const result2 = sort([1, 2], [1]); // 1
const result3 = sort([1, 2, 4], [1, 2, 3]); // -1

Parameters

O: Sortable<A>

Returns

Sortable<ReadonlyArray<A>>