I have a context.ml file where a map is defined
module CtxMap = Map.make(struct type t = int let compare = compare end)
and map_get function with type CtxMap.key -> 'a CtxMap.t -> 'a
map_get
CtxMap.key -> 'a CtxMap.t -> 'a
How to add CtxMap declaration to context.mli file? I cannot find a way to do this, since mli files cannot contain code.
module CtxMap : Map.S with type key = int
In the map.ml file provided with map.ml , the signature name is for the functor S , and key is the only abstract type that you want to open to external modules.
map.ml
S
key
For reference, you can always:
ocamlc -i -c context.ml
to output the default .mli file to stdout. The only problem with this (in your case) is that it extends the signature of the card.
.mli