M is meant to be used in combination with OCaml applicative functor types:
type string_to_int_map = int Map.M(String).twhich stands for:
type string_to_int_map = (String.t, int, String.comparator_witness) Map.tThe point is that int Map.M(String).t supports deriving, whereas the second syntax
doesn't (because there is no such thing as, say, String.sexp_of_comparator_witness
-- instead you would want to pass the comparator directly).
In addition, the requirements to use @@deriving_inline@@@end on the key module are only those
needed to satisfy what you are trying to derive on the map itself. Say you write:
type t = int Map.M(X).t [@@deriving_inline hash][@@@end]then this will be well typed exactly if X contains at least:
t with no parametershash_fold_t function with the right typeK : sig ... end