Skip to main content
Module

x/fun/mod.ts>array.getComparableArray

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

Given an instance Comparable create a Comparable<ReadonlyArray>.

Examples

Example 1

import * as A from "./array.ts";
import { ComparableNumber } from "./number.ts";
import { pipe } from "./fn.ts";

const { compare } = A.getComparableArray(ComparableNumber);

const result1 = pipe([1, 2, 3], compare([1, 2, 3])); // true
const result2 = pipe(A.init(), compare([1, 2, 3])); // false
const result3 = pipe([1, 2], compare([2, 1])); // false

Parameters

unnamed 0: Comparable<A>

Returns

Comparable<ReadonlyArray<A>>