From: Radu Grigore <radugrigore@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] module name alias and typing
Date: Thu, 23 Jun 2011 17:43:04 +0100 [thread overview]
Message-ID: <BANLkTi=JYJ40MRc1jONG3HT2Hg_txQe3eg@mail.gmail.com> (raw)
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).
next reply other threads:[~2011-06-23 16:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-23 16:43 Radu Grigore [this message]
2011-06-23 16:45 ` [Caml-list] " Radu Grigore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTi=JYJ40MRc1jONG3HT2Hg_txQe3eg@mail.gmail.com' \
--to=radugrigore@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox