The following code compiles as expected.
module Int = struct type t = int let compare = compare end
module Util = struct module IntSet = Set.Make (Int) end
let a = Util.IntSet.singleton 0
module U = Util
let b = U.IntSet.mem 0 a
However, if the definition of Int is moved inside Util then the
type-checker complaints that Util.IntSet.t and U.IntSet.t are
incompatible.
module Util =
module Int = struct type t = int let compare = compare end
struct module IntSet = Set.Make (Int)
end
let a = Util.IntSet.singleton 0
module U = Util
let b = U.IntSet.mem 0 a
I thought that "module X = Y" makes the names X and Y refer to the
same module. Is this correct?
Could someone explain what is going on in this example?
I tried with 3.11.2 and with 3.13.0+dev4 (2011-06-20).
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs