Ord

generics. Ord

new Ord()

The generics Ord class. Provides a generic equals method for all data structures which derive from it. Ord can only be derived from classes which implement the Eq typeclass.

Version:
  • 3.0.0
Source:
Example
const {Type} = require('futils').adt;
const {Eq, Ord} = require('futils').generics;

const Int = Type('Int', ['value']).
    deriving(Eq, Ord);

const one = Int(1);
const two = Int(2);

one.lt(two); // -> true
one.lte(one); // -> true
two.gt(one);  // -> true
two.gte(two); // -> true