caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Yallop <yallop@gmail.com>
To: Pietro Abate <pietro.abate@inria.fr>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] small GADT problem
Date: Thu, 19 May 2016 11:13:12 +0100	[thread overview]
Message-ID: <CAAxsn=HBGyCHHH_9hTNS_cV0nN9ZuGw7e+oKtM7ny1v=ht+=hw@mail.gmail.com> (raw)
In-Reply-To: <20160519095135.GA18204@pps.univ-paris-diderot.fr>

On 19 May 2016 at 10:51, Pietro Abate <pietro.abate@inria.fr> wrote:
> I fail to understand why in this simple example below I get a warning.
> Why the type annotations are not enough to convince the compiler that
> the method vartoint cannot accept anything else then UID.a ?
>
> module UID = struct
>
>   type a
>   type b
>   type c

The types 'a', 'b' and 'c' are abstract, so the type checker doesn't
know that they are not equal.  If you give them representations, like
this

  type a = A
  type b = B
  type c = C

 then the fact that they are distinct will become visible to the type
checker and you'll no longer see the warning.

      reply	other threads:[~2016-05-19 10:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19  9:51 Pietro Abate
2016-05-19 10:13 ` Jeremy Yallop [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='CAAxsn=HBGyCHHH_9hTNS_cV0nN9ZuGw7e+oKtM7ny1v=ht+=hw@mail.gmail.com' \
    --to=yallop@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=pietro.abate@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;
as well as URLs for NNTP newsgroup(s).