caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mathieu Barbin <mathieu.barbin@gmail.com>
To: Alain Frisch <alain@frisch.fr>
Cc: Gabriel Scherer <gabriel.scherer@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] GADT: question about inference
Date: Sat, 27 Jul 2013 20:29:33 -0400	[thread overview]
Message-ID: <CANXn40kJj_wzL2QCf1Tm9avBLaYCbiPyqQD8t=FDZVgh-KNsbA@mail.gmail.com> (raw)
In-Reply-To: <51F2E937.7000809@frisch.fr>

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

Got it. I missed that somehow until now. Indeed using eta expansion to
enforce introducing variable-like constructors works well, and looks like a
very reasonable work around for the cases I have in mind.
Thank you very much for the relevant links and the quick answers.


2013/7/26 Alain Frisch <alain@frisch.fr>

> On 7/26/2013 10:27 PM, Gabriel Scherer wrote:
>
>> This is explained in the manual (emphasis mine)
>>    http://caml.inria.fr/pub/docs/**manual-ocaml/manual021.html#**toc85<http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc85>
>>
>>  The constraints associated to each constructor can be recovered through
>>> pattern-matching.
>>> Namely, **if the type of the scrutinee of a pattern-matching contains a
>>> locally abstract type**,
>>> this type can be refined according to the constructor used.
>>>
>>
>> The only types that can be refined by the type equalities introduced
>> by GADT are locally abstract types, the variable-like constructor "a"
>> introduced by the "(type a)" and "foo : type a . bar" syntaxes. Your
>> first two examples have no locally abstract type, only type members of
>> modules, so there was no GADT refinement happening.
>>
>
> A feature request related to allowing more kinds of types to be refined by
> GADT patterns (abstract types in the current environment, introduced by
> unpacking a module -- but the same would be useful for abstract types in a
> functor's argument):
>
> http://caml.inria.fr/mantis/**view.php?id=5713<http://caml.inria.fr/mantis/view.php?id=5713>
>
> -- Alain
>

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

      reply	other threads:[~2013-07-28  0:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 17:15 Mathieu Barbin
2013-07-26 20:27 ` Gabriel Scherer
2013-07-26 21:25   ` Alain Frisch
2013-07-28  0:29     ` Mathieu Barbin [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='CANXn40kJj_wzL2QCf1Tm9avBLaYCbiPyqQD8t=FDZVgh-KNsbA@mail.gmail.com' \
    --to=mathieu.barbin@gmail.com \
    --cc=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.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).