= 1024" x-on:close-sidebar="sidebar=window.innerWidth >= 1024 && true">
ON THIS PAGE
package base
-
base
-
-
base.base_internalhash_types
-
base.caml
-
base.md5
-
base.shadow_stdlib
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
M
is meant to be used in combination with OCaml applicative functor types:
type string_to_int_map = int Map.M(String).t
which stands for:
type string_to_int_map = (String.t, int, String.comparator_witness) Map.t
The 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, when using @@deriving
, the requirements 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 hash]
then this will be well typed exactly if X
contains at least:
- a type
t
with no parameters - a comparator witness
- a
hash_fold_t
function with the right type
Parameters
module K : sig ... end
Signature
type nonrec 'v t = (K.t, 'v, K.comparator_witness) t
ON THIS PAGE