caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: rossberg@mpi-sws.org
To: "Louis Gesbert" <louis.gesbert@mlstate.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Implicitely abstracted type
Date: Thu, 16 Dec 2010 15:23:26 +0100 (CET)	[thread overview]
Message-ID: <90ed143b591fb6560925e0558ad7c18d.squirrel@mail.mpi-sws.org> (raw)
In-Reply-To: <4D0A14BE.9080305@mlstate.com>

> Yesterday I encountered an ocaml error that, if I can now make some
> sense out of it -- it's not properly speaking a bug -- was quite
> confusing at first and took me  some time to figure out.
>
> What happens is that a sum-type defined in a module can implicitely be
> turned into abstract because of its inner contents.
>
> Here is a small example:
> ------
> module F (A : sig type a end) = struct
>   type a = A.a
>   type t = X of A.a
> end
>
> (* if A.a is abstract, the type F.t is made abstract *)
> module A = F (struct type a end)
> (*
>   The inferred interface is:
>   module A : sig type a type t end

That is a well-known limitation. The fix is to name the argument module:

  module TA = struct type a end
  module A = F (TA)

/Andreas


  reply	other threads:[~2010-12-16 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 13:31 Louis Gesbert
2010-12-16 14:23 ` rossberg [this message]
2010-12-16 15:15 ` [Caml-list] " Alain Frisch
2010-12-16 16:03   ` rossberg

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=90ed143b591fb6560925e0558ad7c18d.squirrel@mail.mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --cc=caml-list@inria.fr \
    --cc=louis.gesbert@mlstate.com \
    /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).