Skip to main content
Module

x/fun/option.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/option.ts";

Create an instance of Ord<Option> given an instance of Ord.

Examples

Example 1

import * as O from "./option.ts";
import * as N from "./number.ts";

const Ord = O.getOrd(N.OrdNumber);

const result1 = Ord.compare(O.some(1), O.some(2)); // 1
const result2 = Ord.compare(O.some(1), O.some(1)); // 0
const result3 = Ord.compare(O.none, O.none); // 0
const result4 = Ord.compare(O.none, O.some(1)); // -1