Skip to main content
Module

x/fun/array.ts>getOrd

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

Given an instance Ord create a Ord<ReadonlyArray>.

Examples

Example 1

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

const { compare } = A.getOrd(OrdNumber);

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

Returns

Ord<ReadonlyArray<A>>