I’d like to put a hashtable inside a struct which is comparable (via
[@@deriving eq]), in v2 of Real World OCaml I found that I can use the
.M functor to create a new module which I can derive:
type string_int_map = int Map.M(String).t
which is more or less equivalent to the more common
type string_int_map = (string, int) Map.t
However, if I try the same with a
type string_int_table = int Hashtbl.M(String).t [@@deriving eq]
I get the following error:
File "_none_", line 1: Error: broken invariant in parsetree: Functor application not allowed here.
[@@deriving eq] fixes is, and I get the expected error:
File "_none_", line 1: Error: Unbound value equal_string_int_table
So, my question is, how can I convince ppx_deriving to correctly derive the module?