Skip to main content
Module

x/fun/mod.ts>option.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 option.getOrd
import { option } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { getOrd } = option;

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

Parameters

O: Ord<A>