Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fun/option.ts>getComparableOption

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

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

Examples

Example 1

import * as O from "./option.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";

const { compare } = O.getComparableOption(N.ComparableNumber);

const result1 = pipe(O.some(1), compare(O.some(2))); // false
const result2 = pipe(O.some(1), compare(O.some(1))); // true
const result3 = pipe(O.none, compare(O.none)); // true
const result4 = pipe(O.some(1), compare(O.none)); // false