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

x/fun/mod.ts>comparable.Comparable

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

A Comparable is an algebra with a notion of equality. Specifically, a Comparable for a type T has an equal method that determines if the two objects are the same. Comparables can be combined, like many algebraic structures. The combinators for Comparable in fun can be found in comparable.ts.

An instance of a Comparable must obey the following laws:

  1. Reflexivity: compare(a, a) === true
  2. Symmetry: compare(a, b) === compare(b, a)
  3. Transitivity: if compare(a, b) and compare(b, c), then compare(a, c)