package spotlib
Source file mtypes.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39(** Some useful module capabilities *) module type Printable = sig type t val show : t -> string val format : Format.formatter -> t -> unit end module type Comparable = sig type t val compare : t -> t -> int val equal : t -> t -> bool module Infix : sig val (=) : t -> t -> bool val (<>) : t -> t -> bool val (<) : t -> t -> bool val (>) : t -> t -> bool val (<=) : t -> t -> bool val (>=) : t -> t -> bool end end module Make_comparable(A : sig type t val compare : t -> t -> int end) : Comparable with type t := A.t = struct let compare = A.compare module Infix = struct let (<) t1 t2 = compare t1 t2 = -1 let (>) t1 t2 = compare t1 t2 = 1 let (<=) t1 t2 = compare t1 t2 <= 0 let (>=) t1 t2 = compare t1 t2 >= 0 let (=) t1 t2 = compare t1 t2 = 0 let (<>) t1 t2 = compare t1 t2 <> 0 end let equal = Infix.(=) end module type Hashable = Hashtbl.HashedType