caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Private types and subtyping
@ 2015-05-11 16:31 Stephen Dolan
  2015-05-11 17:10 ` Jeremy Yallop
  2015-05-13 20:09 ` Leo White
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Dolan @ 2015-05-11 16:31 UTC (permalink / raw)
  To: Ocaml Mailing List

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-13 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 16:31 [Caml-list] Private types and subtyping Stephen Dolan
2015-05-11 17:10 ` Jeremy Yallop
2015-05-13 20:09 ` Leo White

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).