module Make:
module Foo = struct
module T = struct
type t = ... with compare, sexp
end
include T
include Comparable.Make (T)
end
Then include Comparable.S in the signature (see comparable_intf.mli for an
example).
To add an Infix submodule:
module C = Comparable.Make (T)
include C
module Infix = (C : Comparable.Infix with type t := t)
Common pattern: Define a module O with a restricted signature. It aims to be
(locally) opened to bring useful operators into scope without shadowing unexpected
variable names. E.g. in the Date module:
module O = struct
include (C : Comparable.Infix with type t := t)
let to_string t = ..
end
Opening Date would shadow now, but opening Date.O doesn't:
let now = .. in
let someday = .. in
Date.O.(now > someday)
| Parameters: |
|
include Comparable_intf.S_common
module Map:Core_map.Swith type Key.t = twith type Key.comparator_witness = comparator_witness
module Set:Core_set.Swith type Elt.t = twith type Elt.comparator_witness = comparator_witness