module Identifiable: Identifiablemodule type S =sig..end
module Make:functor (M:sigtypetinclude Stringable.Sval hash :t -> intval module_name :stringval t_of_sexp :Sexplib.Sexp.t -> tval sexp_of_t :t -> Sexplib.Sexp.tval compare :t -> t -> intval bin_t :t Bin_prot.Type_class.tval bin_read_t :t Bin_prot.Read_ml.readerval bin_read_t_ :t Bin_prot.Unsafe_read_c.readerval bin_read_t__ :(int -> t) Bin_prot.Unsafe_read_c.readerval bin_reader_t :t Bin_prot.Type_class.readerval bin_size_t :t Bin_prot.Size.sizerval bin_write_t :t Bin_prot.Write_ml.writerval bin_write_t_ :t Bin_prot.Unsafe_write_c.writerval bin_writer_t :t Bin_prot.Type_class.writerend) ->Swith type t := M.t
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)
end
include T
include Identifiable.Make (T)
end
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.