From: Aaron Bohannon <bohannon@cis.upenn.edu>
To: Caml List <caml-list@inria.fr>
Subject: exceptions in recursive modules
Date: Mon, 06 Dec 2004 21:26:51 -0500 [thread overview]
Message-ID: <41B514EB.7030707@cis.upenn.edu> (raw)
I was trying to use a recursive module but was getting unexpected
"Undefined_recursive_modules" exceptions. After a long debugging
session, I discovered the source of my problem to be exception
declarations in the module. I don't intuitively understand why they
cause a problem, and as I cannot find documentation of the behavior, I
am wondering if it might be a bug.
Here is the example. This is essentially the example in the manual, but
I have added an exception to the module:
module rec A : sig
type t = Leaf of int | Node of ASet.t
exception Fail
val compare : t -> t -> int
end = struct
type t = Leaf of int | Node of ASet.t
exception Fail
let rec compare = (* suitable definition *)
end
and ASet : Set.S with type elt = A.t = Set.Make(A)
Then we can try to use it:
# let x = A.Leaf(3);;
val x : A.t = A.Leaf 3
# let s = ASet.add x ASet.empty;;
val s : ASet.t = <abstr>
# let s' = ASet.add x s;;
Exception: Undefined_recursive_module ("recmodtest.ml", 6, 6).
If we remove the "exception Fail" from the signature, everything works
just fine. Is this behavior correct? (I am using OCaml 3.08.1)
Aaron
--
Aaron Bohannon
http://www.cis.upenn.edu/~bohannon/
next reply other threads:[~2004-12-07 2:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-07 2:26 Aaron Bohannon [this message]
2004-12-07 6:58 ` [Caml-list] " Tom Hirschowitz
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=41B514EB.7030707@cis.upenn.edu \
--to=bohannon@cis.upenn.edu \
--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