Module Identifiable

module Identifiable: sig .. end
a signature for opaque identifier types.

module type S = sig .. end
module Make: 
functor (M : sig
type t 
include Stringable.S
val hash : t -> int
val module_name : string
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> int
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read_ml.reader
val bin_read_t_ : t Bin_prot.Unsafe_read_c.reader
val bin_read_t__ : (int -> t) Bin_prot.Unsafe_read_c.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write_ml.writer
val bin_write_t_ : t Bin_prot.Unsafe_write_c.writer
val bin_writer_t : t Bin_prot.Type_class.writer
end) -> S with type t := M.t

There used to be a functor Identifiable.Of_sexpable, but we removed it because it encouraged a terrible implementation of Identifiable.S. In particular, hash, compare, and bin_io were all built by converting the type to a sexp, and then to a string.

One should use Identifiable.Make instead. Here is what a use might look like:

      module Id = struct
        module T = struct
          type t = A | B with bin_io, compare, sexp
          let hash (t : t) = Hashtbl.hash t
          include Sexpable.To_stringable (struct type nonrec t = t with sexp end)
        include T
        include Identifiable.Make (T)

We also removed Identifiable.Of_stringable, which wasn't as obviously bad as Of_sexpable. But it still used the string as an intermediate, which is often the wrong choice -- especially for compare and bin_io, that can be generated by preprocessors.