I have a file context.ml where a map is defined
module CtxMap = Map.make(struct type t = int let compare = compare end)
and a function map_get
with type CtxMap.key -> 'a CtxMap.t -> 'a
How do I add the CtxMap declaration to the context.mli file? I can't find a way to do it as mli files can't contain code.
module CtxMap : Map.S with type key = int
In the map.ml
file provided with ocaml, the name of the signature for the functor is S
, and key
is the only abstract type you want to expose to the outside modules.
For reference, you can always do:
ocamlc -i -c context.ml
to output the default .mli
file to stdout. The only issue with this (in your case) is that it expands the signature of the map.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With