caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@gmail.com>
To: Dan Bensen <danbensen@att.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] extending user-defined polymorphic variant types
Date: Mon, 7 May 2012 13:37:19 +0200	[thread overview]
Message-ID: <CAOOOohTJ2cL8AL1aUF7jqjqwSbODa7pZnvK=B=6eHgzGuAPwzg@mail.gmail.com> (raw)
In-Reply-To: <1336383633.2612.YahooMailRC@web180006.mail.gq1.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

Hi Dan,

I'm afraid you can't. If you want to write unions of polymorphic variant
types, they have to be concrete and not abstract. See Romain Bardou's work
on this:

http://romain.bardou.fr/papers/stage2006p.pdf

Or, if you can read french:

www.math.nagoya-u.ac.jp/~garrigue/papers/index.html

(see Unions de variants polymorphes abstraits).

Cheers,
  Philippe.



2012/5/7 Dan Bensen <danbensen@att.net>

>
> I'm trying to write a functor that extends a user-supplied polymorphic
> variant type (PVT).  How do you declare the user's type in the signature
> for the argument to the functor without locking in the individual variant
> definitions?
> The code below (in revised syntax) generates an error message that says
> the type isn't a PVT.
>
> code:
>
> > module type Reader = sig type ast; end;
> >
> > module Make (Read: Reader) = struct
> >   type ast = [= Read.ast | `Lid of string];
> > end;
>
> message:
>
> > Error: The type Read.ast is not a polymorphic variant type
>
> How do you make ast a PVT while allowing the user to
> specify the variants?
>

[-- Attachment #2: Type: text/html, Size: 1702 bytes --]

  reply	other threads:[~2012-05-07 11:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07  9:40 Dan Bensen
2012-05-07 11:37 ` Philippe Veber [this message]
2012-05-07 16:47 ` Goswin von Brederlow
2012-05-07 18:55   ` Dan Bensen
2012-05-07 20:17     ` Dan Bensen

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='CAOOOohTJ2cL8AL1aUF7jqjqwSbODa7pZnvK=B=6eHgzGuAPwzg@mail.gmail.com' \
    --to=philippe.veber@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=danbensen@att.net \
    /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).