caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Yallop <yallop@gmail.com>
To: Stephen Dolan <stephen.dolan@cl.cam.ac.uk>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Private types and subtyping
Date: Mon, 11 May 2015 18:10:04 +0100	[thread overview]
Message-ID: <CAAxsn=EwqYHea7TdKS4SX+PktJ2sVOm3jAbCWD5n4hj5uy8iPQ@mail.gmail.com> (raw)
In-Reply-To: <CA+mHimNCS+Uvx7aVJDBU8Xo_62LSLJFUUBn+JBMtEBtTuhzi3A@mail.gmail.com>

On 11 May 2015 at 17:31, Stephen Dolan <stephen.dolan@cl.cam.ac.uk> wrote:
> 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?

This isn't quite an answer to your question, but private rows might do
what you need:

   module Sub : sig
     type t = private [<`A | `B]
   end = struct
     type t = [`A]
   end

Jeremy.

  reply	other threads:[~2015-05-11 17:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 16:31 Stephen Dolan
2015-05-11 17:10 ` Jeremy Yallop [this message]
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='CAAxsn=EwqYHea7TdKS4SX+PktJ2sVOm3jAbCWD5n4hj5uy8iPQ@mail.gmail.com' \
    --to=yallop@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=stephen.dolan@cl.cam.ac.uk \
    /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).