From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id EAF01BC69 for ; Fri, 9 Mar 2007 17:44:08 +0100 (CET) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l29Gi8RQ007529 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 9 Mar 2007 17:44:08 +0100 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HPiC9-0002n2-4T for caml-list@inria.fr; Fri, 09 Mar 2007 17:43:53 +0100 Received: from pps-gw.pps.jussieu.fr ([134.157.168.126]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Mar 2007 17:43:53 +0100 Received: from li by pps-gw.pps.jussieu.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Mar 2007 17:43:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Zheng Li Subject: Re: Constraint missbehaviours?? Date: Fri, 09 Mar 2007 17:30:13 +0100 Message-ID: <877itqz8fe.fsf@pps.jussieu.fr> References: <9d3ec8300703090713l5a49ebbbt974acff4bee738a6@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pps-gw.pps.jussieu.fr User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux) Cancel-Lock: sha1:A5ixa+Wx5Y33uESmjEAarvNPRvY= Sender: news X-Miltered: at discorde with ID 45F18ED8.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; checker:01 unify:01 polymorphic:01 writes:01 pps:01 pps:01 jussieu:01 jussieu:01 constraint:01 constraint:01 mul:02 mul:02 exp:02 exp:02 parameters:02 "Till Varoquaux" writes: > type 'a exp2=[ > | 'a exp > | `Sub of 'e * 'e > | `Mul of 'e * 'e > ] > constraint 'a = ;; > > 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 = [ | ( as 'a) exp | `Sub of 'e * 'e | `Mul of 'e * 'e ] constraint 'a = ;; 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