From: Markus Mottl <markus.mottl@gmail.com>
To: OCaml List <caml-list@inria.fr>
Subject: [Caml-list] Manifest types in module type inclusions
Date: Sun, 26 Dec 2010 00:19:46 -0500 [thread overview]
Message-ID: <AANLkTikyvcJNH2iQQQ9bSB4x0j1Y2egexHCKg-XiHDY0@mail.gmail.com> (raw)
Hi,
please consider the following code:
-------------------
module M = struct type t = A | B end
module X : sig
(* type t = M.t = A | B *)
include module type of M
(* include module type of M with type t = M.t = A | B *)
end = struct include M end
let () = assert (M.A = X.A)
-------------------
This will fail, because M.A is not of the same type as X.A. But I
would really like to make the types equivalent.
Using the first commented out line instead of the module type
inclusion will succeed, but then I would not be able to automatically
include any functions potentially contained in module M. The last
commented out line won't work, because one cannot establish a type
equivalence via a manifest type definition after "with type". Even
if, I don't think one could override anything else but an abstract
type that way, and we are including a sum type here already.
Does anybody have any suggestions for a workaround? I suspect this
may be a missing feature.
Regards,
Markus
--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
next reply other threads:[~2010-12-26 5:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-26 5:19 Markus Mottl [this message]
2010-12-26 5:56 ` 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=AANLkTikyvcJNH2iQQQ9bSB4x0j1Y2egexHCKg-XiHDY0@mail.gmail.com \
--to=markus.mottl@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