Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>option.getSortableOption

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function option.getSortableOption
import { option } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { getSortableOption } = option;

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

Examples

Example 1

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

const { sort } = O.getSortableOption(N.SortableNumber);

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

Parameters

unnamed 0: Sortable<A>

Returns

Sortable<Option<A>>