Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Yannis Juglaret <yjuglaret@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Matching exhausitvity with GADT and modules
Date: Wed, 27 May 2015 17:36:59 +0200	[thread overview]
Message-ID: <5565E49B.9090209@gmail.com> (raw)
In-Reply-To: <5565E11B.7010300@giovannangeli.fr>

Hi,

Removing this warning is not a good solution, because this warning may 
be relevant the day you update your GADT. As far as I know, you should 
always be using concrete types. Read for example: 
<http://stackoverflow.com/questions/20692885/gadt-definition>.

This is a question to the list: is there any good reason for allowing 
abstract types in module implementations, and not just in module 
signatures -- where they can actually be used to abstract types?

-- Yannis

Le 27/05/2015 17:22, Joris Giovannangeli a écrit :
>
>> This is a common problem that has annoyed me as well. The issue is that
>> B sees foo and bar as abstract types, so cannot be sure they are
>> different, so cannot be sure that a value of type foo gadt can't be
>> constructed with Bar. If you add explicit constructors for both
>> currently-empty types, then their inequality will be exposed and your
>> pattern match should work.
>
> That's a nice workaround in the case where foo and bar and phantom types
> indeed. Just adding a dummy constructor. In case they are real abstract
> type, someone advised me to disable the exhaustivity warning locally
> with [@@warning "-8"] code annotation, which is a bit more hack-ish.
>
> Thanks
>
>

  reply	other threads:[~2015-05-27 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 15:04 Joris Giovannangeli
2015-05-27 15:14 ` Ben Millwood
2015-05-27 15:22   ` Joris Giovannangeli
2015-05-27 15:36     ` Yannis Juglaret [this message]
2015-05-27 20:22       ` Alain Frisch
2015-05-27 15:43   ` Arseniy Alekseyev

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=5565E49B.9090209@gmail.com \
    --to=yjuglaret@gmail.com \
    --cc=caml-list@inria.fr \
    /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