Reputation: 25812
I have airport.mli
and airport.ml
.
In airport.ml
, I have
module AirportSet = Set.Make(struct type t = airport let compare = compare end);;
This is no problem.
I then have a function
val get_all_airport : unit -> AirportSet.t;;
, which generates a AirportSet
.
so in airport.mli
, I need to show the module AirportSet
so AirportSet
is recognized.
How can I do that?
Upvotes: 6
Views: 560
Reputation: 1032
The elegant solution is was gasche proposed; a more pragmatic/straight forward/naive solution is to simply use the ocaml-compiler ocamlc
to infer (-i
) the type of the module for you:
ocamlc -i airport.ml
which gives you a more verbose type like
AirportSet :
sig
type elt = airport
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
...
val split : elt -> t -> t * bool * t
end
Upvotes: 0
Reputation: 31459
module AirportSet : (Set.S with type elt = airport)
(The parens are actually unnecessary, putting them there so that you know this is a signature expected, in the general case of the form sig ... end
).
Upvotes: 11