caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: Dario Teixeira <darioteixeira@yahoo.com>, caml <caml-list@inria.fr>
Subject: Re: [Caml-list] PV-GADTs
Date: Wed, 14 Dec 2011 10:12:03 -0500	[thread overview]
Message-ID: <CAP_800prd2bSRB=GN+mSpfK7oYYiqoC8yYy8Sagyq1aPL8Hi=Q@mail.gmail.com> (raw)
In-Reply-To: <CA+p7B-zqC5Sm9wtiK6kR3O7BJ=w365dufRf_q1-dryb7UgR5qg@mail.gmail.com>

On Tue, Dec 13, 2011 at 21:56, Jacques Garrigue
<garrigue@math.nagoya-u.ac.jp> wrote:
> In your example, how do you know in a pattern-matching that `Foo comes from t2?
> Type inference could be used, but I'm afraid it would be very fragile,
> and  not easy to use.
> So at this point there is no plan to add GADT PVs.
>
> An alternative design would be to have extensible GADTs, where you would be able
> to add new cases, like for exn.
> I think this would be useful, and cover some uses that are not
> possible even with PVs.

I really like using PVs for defining extensible, recursive DSLs.  If
it were possible to use GADTs in a similar way, that would be an
awesome feature.  But I wonder how this could be done cleanly.  I
agree that type inference would be impractical when combining PVs and
GADTs, since PV constructors are not tied to a specific type.

It seems you have something in particular in mind when you speak of
extensible GADTs.  Wouldn't such a feature require that GADTs have the
same runtime representation as PVs, i.e. using the hash value of the
variant name?  Not sure what the GADT representation is right now
anyway, but maybe this should be determined carefully before the next
release if we want to add extensibility later.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


      reply	other threads:[~2011-12-14 15:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 14:35 Dario Teixeira
2011-12-13 15:00 ` Jacques Le Normand
2011-12-13 19:15   ` Dario Teixeira
2011-12-14  2:56 ` Jacques Garrigue
2011-12-14 15:12   ` Markus Mottl [this message]

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='CAP_800prd2bSRB=GN+mSpfK7oYYiqoC8yYy8Sagyq1aPL8Hi=Q@mail.gmail.com' \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=darioteixeira@yahoo.com \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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).