Module Relude_Ordering
Contains functions and typeclass instances for the ordering
type - the enum with inhabitants `less_than
, `equal_to
, and `greater_than
.
Functions that deal with comparing values don't belong here - these go in Relude_Ord
and Relude_Extensions_Ord
. This module is just for working with values of type ordering
.
let fromInt: int => t;
Ordering.fromInt
converts an int to a type-safe ordering value. This can be helpful for working with other functions in the OCaml world that normally use-1
to indicate`less_than
,0
to indicate`equal_to
, and1
to indicate`greater_than
.
let toInt: t => int;
Ordering.toInt
converts a type-safe ordering value to an int. This is useful when working with OCaml libraries that expect-1
for less than,0
for equal and1
for greater than.
let reverse: t => t;
Ordering.reverse
reverses the value of the ordering (`greater_than
becomes`less_than
and vice versa).
let compare: t => t => t;
Ordering.compare
ompares two orderings (`less_than < `equal_to < `greater_than
).
include { ... };
let compareWithConversion: ('b => Ord.t) => Relude_Ord.compare('b);
let compareReversed: Relude_Ord.compare(Ord.t);
module OrdReversed: { ... };
let compareAsInt: Ord.t => Ord.t => int;
let min: Ord.t => Ord.t => Ord.t;
let max: Ord.t => Ord.t => Ord.t;
let lessThan: Ord.t => Ord.t => bool;
let lt: Ord.t => Ord.t => bool;
let lessThanOrEq: Ord.t => Ord.t => bool;
let lte: Ord.t => Ord.t => bool;
let greaterThan: Ord.t => Ord.t => bool;
let gt: Ord.t => Ord.t => bool;
let greaterThanOrEq: Ord.t => Ord.t => bool;
let gte: Ord.t => Ord.t => bool;
let clamp: min:Ord.t => max:Ord.t => Ord.t => Ord.t;
let between: min:Ord.t => max:Ord.t => Ord.t => bool;
module OrdRingExtensions: (R: { ... }) => { ... };
module OrdNamed: { ... };
include { ... };
module BoundedEnum: Relude_Interface.BOUNDED_ENUM with type BoundedEnum.t = t;
include { ... };
let fromThenToAsList: start:BoundedEnum.t => next:BoundedEnum.t => finish:BoundedEnum.t => list(BoundedEnum.t);