Skip to main content
Module

x/fun/mod.ts>array.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 array.getOrd
import { array } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { getOrd } = array;

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

Parameters

O: Ord<A>

Returns

Ord<ReadonlyArray<A>>