Module BatOrd.Incubator

module Incubator: sig .. end

val eq_by : ('a -> 'b) -> 'a BatOrd.eq
val comp_by : ('a -> 'b) -> 'a BatOrd.comp
val ord_by : ('a -> 'b) -> 'a BatOrd.ord

Build a eq, cmp or ord function from a projection function. For example, if you wanted to compare integers based on their lowest 4 bits, you could write let cmp_bot4 = cmp_by (fun x
        -> x land 0xf)
and use cmp_bot4 as the desired integer comparator.