type 'a t
val make : ('a -> 'a -> int) -> (Stdlib.Format.formatter -> 'a -> unit) -> 'a t
make compare pp
constructs a comparator using the given compare
to compare value and pp
to print them.
val compare : 'a t -> 'a -> 'a -> int
compare c x y
compares x
and y
using the c
comparator.
val pp : 'a t -> Stdlib.Format.formatter -> 'a -> unit
pp c x
prints x
using the c
comparator.
val int : int t
int
is an integer comparator.
val float : float t
float
is a float comparator.
val bool : bool t
bool
is a bool comparator.
val string : string t
string
is a string comparator.
val tuple : 'a t -> 'b t -> ('a * 'b) t
tuple c1 c2
creates a comparator for tuples using the comparators c1
and c2
.
val list : 'a t -> 'a list t
tuple c
creates a comparator for lists using the the comparator c
for comparing elements.
val array : 'a t -> 'a array t
array c
creates a comparator for arrays using the the comparator c
for comparing elements.
val option : 'a t -> 'a option t
option c
creates a comparator for options using the the comparator c
for comparing elements.
val result : ok:'a t -> error:'e t -> ('a, 'e) Stdlib.result t
option ~ok ~error
creates a comparator for result values using the the comparators ok
and error
.