Comparable.With_compareVarious combinators for compare and equal functions.
lexicographic cmps x y compares x and y lexicographically using functions in the list cmps.
lift cmp ~f x y compares x and y by comparing f x and f y via cmp.
reverse cmp x y = cmp y x
Reverses the direction of asymmetric relations by swapping their arguments. Useful, e.g., for relations implementing "is a subset of" or "is a descendant of".
Where reversed relations are already provided, use them directly. For example, Comparable.S provides ascending and descending, which are more readable as a pair than compare and reverse compare. Similarly, <= is more idiomatic than reverse (>=).
The functions below are analogues of the type-specific functions exported by the Comparable.S interface.