Ordering

equal

RES
let equal: float

fromInt

RES
let fromInt: int => float

fromInt(n) converts an integer comparison result into an ordering.

Examples

RES
Ordering.fromInt(-5) == Ordering.less Ordering.fromInt(0) == Ordering.equal Ordering.fromInt(3) == Ordering.greater

greater

RES
let greater: float

ignore

RES
let ignore: t => unit

ignore(ordering) ignores the provided ordering and returns unit.

This helper is useful when you want to discard a value (for example, the result of an operation with side effects) without having to store or process it further.

invert

RES
let invert: float => float

invert(ordering) flips the ordering result (less becomes greater and vice versa).

Examples

RES
Ordering.invert(Ordering.less) == Ordering.greater Ordering.invert(Ordering.equal) == Ordering.equal

isEqual

RES
let isEqual: float => bool

isEqual(ordering) returns true when ordering equals Ordering.equal.

Examples

RES
Ordering.isEqual(Ordering.equal) == true Ordering.isEqual(Ordering.greater) == false

isGreater

RES
let isGreater: float => bool

isGreater(ordering) returns true when ordering equals Ordering.greater.

Examples

RES
Ordering.isGreater(Ordering.greater) == true Ordering.isGreater(Ordering.less) == false

isLess

RES
let isLess: float => bool

isLess(ordering) returns true when ordering equals Ordering.less.

Examples

RES
Ordering.isLess(Ordering.less) == true Ordering.isLess(Ordering.equal) == false

less

RES
let less: float

t

RES
type t = float

Ordering values represent the result of a comparison: less, equal, or greater.