From: Stephen Dolan <stephen.dolan@cl.cam.ac.uk>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] Private types and subtyping
Date: Mon, 11 May 2015 17:31:03 +0100 [thread overview]
Message-ID: <CA+mHimNCS+Uvx7aVJDBU8Xo_62LSLJFUUBn+JBMtEBtTuhzi3A@mail.gmail.com> (raw)
My intuition is that exporting a private type from a module with "type
t = private foo" makes "t" a new subtype of "foo". So, any means of
eliminating "foo" can eliminate "t", but constructing my own "foo"
does not necessarily mean I've made a "t".
This intuition also says the following should be OK:
module Sub : sig
type t = private [`A | `B]
end = struct
type t = [`A]
end
The compiler (4.02.1) rejects this. Is this just a missing feature, or
is there some deep reason I'm missing why the above is not OK?
Stephen
next reply other threads:[~2015-05-11 16:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 16:31 Stephen Dolan [this message]
2015-05-11 17:10 ` Jeremy Yallop
2015-05-13 20:09 ` Leo White
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=CA+mHimNCS+Uvx7aVJDBU8Xo_62LSLJFUUBn+JBMtEBtTuhzi3A@mail.gmail.com \
--to=stephen.dolan@cl.cam.ac.uk \
--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;
as well as URLs for NNTP newsgroup(s).