caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Zheng Li <li@pps.jussieu.fr>
To: caml-list@inria.fr
Subject: Re: Constraint missbehaviours??
Date: Fri, 09 Mar 2007 17:30:13 +0100	[thread overview]
Message-ID: <877itqz8fe.fsf@pps.jussieu.fr> (raw)
In-Reply-To: <9d3ec8300703090713l5a49ebbbt974acff4bee738a6@mail.gmail.com>

"Till Varoquaux" <till.varoquaux@gmail.com> writes:
> type 'a exp2=[
> | 'a exp
> | `Sub of 'e * 'e
> | `Mul of 'e * 'e
> ]
> constraint 'a = <exp2:'e;..>;;
>
> doesn't type correctly but seems perfectly legal to me... Am I missing
> anything here?

Don't understand the purpose why you programming this way. But if what you want
the type check to recognize the `Mul 'e * 'e here has the same 'e as the 'e
inside 'a exp, you should explicit it, I don't see reasons why type checker
will unify these two polymorphic type parameters.

# type 'a exp2 = [
| (<exp:'e; ..> as 'a) exp
| `Sub of 'e * 'e
| `Mul of 'e * 'e
] constraint 'a = <exp2:'e; ..>;;
type 'a exp2 = [ `Add of 'b * 'b | `Mul of 'b * 'b | `Sub of 'b * 'b ]
constraint 'a = < exp : 'b; exp2 : 'b; .. >



-- 
Zheng Li
http://www.pps.jussieu.fr/~li


      reply	other threads:[~2007-03-09 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-09 15:13 Till Varoquaux
2007-03-09 16:30 ` Zheng Li [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=877itqz8fe.fsf@pps.jussieu.fr \
    --to=li@pps.jussieu.fr \
    --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;
as well as URLs for NNTP newsgroup(s).