From: "Yaron Minsky" <yminsky@gmail.com>
To: "Caml Mailing List" <caml-list@inria.fr>
Subject: A confusing module question
Date: Fri, 11 Jan 2008 14:05:34 -0500 [thread overview]
Message-ID: <891bd3390801111105xb75df53id4358939e8b2b05c@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]
Here's some fairly simple module code that fails unexpectedly. N compiles
cleanly, but M has an error, even though they seem like they should both
work:
module type S = sig type t end
module M :
sig
type exposed_t = { foo : int }
include S with type t = exposed_t
end =
struct
type t = { foo : int }
type exposed_t = t
end
module N :
sig
type exposed_t = { foo : int }
include S with type t = exposed_t
end =
struct
type exposed_t = { foo : int }
type t = exposed_t
end
The error is as follows:
File "foo.ml", line 8, characters 0-56:
Signature mismatch:
Modules do not match:
sig type t = { foo : int; } type exposed_t = t end
is not included in
sig type exposed_t = { foo : int; } type t = exposed_t end
Type declarations do not match:
type exposed_t = t
is not included in
type exposed_t = { foo : int; }
I've been programming in OCaml for along time, and I still don't have a
really good mental model to understand when some module trick I try is going
to work. How do people think about things like this?
y
[-- Attachment #2: Type: text/html, Size: 4236 bytes --]
next reply other threads:[~2008-01-11 19:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-11 19:05 Yaron Minsky [this message]
2008-01-11 20:59 ` [Caml-list] " Jeremy Yallop
2008-01-11 23:38 ` Zheng Li
2008-01-14 9:02 ` [Caml-list] " Keiko Nakata
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=891bd3390801111105xb75df53id4358939e8b2b05c@mail.gmail.com \
--to=yminsky@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