From: "Charles Hymans" <charles.hymans@gmail.com>
To: caml-list@yquem.inria.fr
Subject: typing of recursive modules in 3.10.2
Date: Tue, 10 Jun 2008 21:27:21 +0200 [thread overview]
Message-ID: <676aba050806101227m1696d555n6f23f55f57af0db2@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]
Hi,
I have encountered a behavior of the type checking of recursive modules
which is hard for me to understand.
Especially so, since the code used to compile with Ocaml 3.10.0 but does not
with 3.10.2. And, an almost similar piece of code compiles correctly.
I tried to extract the smallest piece of code that exhibits the problem, but
it's still quite long. Sorry.
Here is the code that does not type with 3.10.2:
=======================================
module type BSig =
sig
type t
val f: t -> unit
end
module type ASig = functor(B: BSig) ->
sig
type t
val g: B.t -> unit
end
module Make(C: BSig) =
struct
type t = int
let g _ = ()
end
module MakeA = (Make: ASig)
module rec A:
sig
type t
val g: B.t -> unit
end
= MakeA(B)
and B:
sig
type t = int * A.t
val f: t -> unit
end
=
struct
type t = int * A.t
let f x = A.g x (* does not type *)
(*
let f (a, b) = A.g (a, b) (* types correctly *)
*)
end
=========================
Note that if function f is replaced by the commented version, then the type
checker succeeds. Even though, this code modification is only giving the
additional information that the argument of f is a pair.
It would be nice for both versions of the code to compile, because the
current behavior of the type checker seems to me not easily predictable.
Thank you in advance for your help,
[-- Attachment #2: Type: text/html, Size: 1917 bytes --]
next reply other threads:[~2008-06-10 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 19:27 Charles Hymans [this message]
2008-06-11 9:25 ` [Caml-list] " Josh Berdine
2008-06-11 10:51 ` Charles Hymans
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=676aba050806101227m1696d555n6f23f55f57af0db2@mail.gmail.com \
--to=charles.hymans@gmail.com \
--cc=caml-list@yquem.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