If I have an implementation (.re
) file containing
module IntMap =
Map.Make {
type t = int;
let compare = compare;
};
type foo = IntMap.t string;
how can I add the signature of foo
to the interface (.rei
) file? In analogy with OCaml's
module IntMap = Map.S with type key = int
type foo = string IntMap.t
I expected it to be
module IntMap =
Map.S {
type t = int;
};
type foo = IntMap.t string;
but that results in a syntax error at {
.
I suspect the root cause of your problem is that the OCaml code you posted is not valid. It should be
The Reason equivalent then is
Not very different :)
Also, in case you're not aware of it, reason-tools is a great tool that will convert between Reason and OCaml for you. It does require valid input though ;)