From: "Paul A. Steckler" <steck@stecksoft.com>
To: caml-list@inria.fr
Subject: [Caml-list] Typing issue in explicit module
Date: Tue, 29 Aug 2017 15:13:08 -0400 [thread overview]
Message-ID: <CAMSKV5ceyX3nb1BoraS3M5YOV99J5GtfVPERLwtnKKN-+Aa2mw@mail.gmail.com> (raw)
Here's some code that compiles successfully with 4.05.0 ocamlc. The .ml file is:
.ml file:
--
type t
let id x = x
let idid = id id
--
.mli file:
--
type t
val id: 'a -> 'a
val idid : t -> t
--
If I wrap the code in an explicit module, I get a type error:
.ml file:
--
module Foo =
struct
<code as before>
end
--
.mli file:
--
module Foo :
sig
<code as before>
end
--
With this change made, ocamlc complains:
--
Error: The implementation Foo.ml does not match the interface Foo.cmi:
In module Foo:
Modules do not match:
sig type t = Foo.t val id : 'a -> 'a val idid : '_a -> '_a end
is not included in
sig type t val id : 'a -> 'a val idid : t -> t end
In module Foo:
Values do not match:
val idid : '_a -> '_a
is not included in
val idid : t -> t
--
Adding a type annotation t -> t to the definition of "idid" gets rid
of the error.
With OCaml 4.04.0, no error occurs, and the type annotation is
unnecessary. Is this change expected?
The code I've shown is a simplified version of OCaml code extracted
from a Coq script, reported as a bug in Coq:
https://coq.inria.fr/bugs/show_bug.cgi?id=5705.
-- Paul
next reply other threads:[~2017-08-29 19:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 19:13 Paul A. Steckler [this message]
2017-08-30 22:20 ` Jacques Garrigue
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=CAMSKV5ceyX3nb1BoraS3M5YOV99J5GtfVPERLwtnKKN-+Aa2mw@mail.gmail.com \
--to=steck@stecksoft.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