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=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 521D4BB83 for ; Sun, 3 Sep 2006 02:48:51 +0200 (CEST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k830miiY021823 for ; Sun, 3 Sep 2006 02:48:50 +0200 Received: from rosella (ppp14-47.lns2.syd7.internode.on.net [59.167.14.47]) by smtp1.adl2.internode.on.net (8.13.6/8.13.5) with ESMTP id k830mT9q088028 for ; Sun, 3 Sep 2006 10:18:31 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: [Caml-list] Polymorphic variants problem From: skaller To: caml-list In-Reply-To: <1157138993.22787.34.camel@rosella.wigram> References: <012901c6cdec$64edf490$6a7ba8c0@treble> <1157138993.22787.34.camel@rosella.wigram> Content-Type: text/plain Date: Sun, 03 Sep 2006 10:48:29 +1000 Message-Id: <1157244509.12057.29.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 44FA266C.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; variants:01 mli:01 inference:01 ocaml:01 intersection:01 typecode:01 typecode:01 2006:98 sourceforge:01 wrote:01 wrote:01 polymorphic:01 caml-list:01 expression:01 flx:01 On Sat, 2006-09-02 at 05:29 +1000, skaller wrote: I wrote this: > (b) annotate function arguments and returns -- if not > all of them, focus on the top level ones: it's necessary > for the mli file anyhow. Now, I just tried to use my super term union, but I ran into a problem. It looks like a fault in type inference, something like this: let f (x:[`A|`B]) = .. let g (x:[`A]) = .. .. fun x -> f x; g x; .. I get a type error on g x, Ocaml is telling me x has type [`A|`B] but is used in a context requiring a type [`A]. Of course the problem is evident: the actual type is indeed [`A], but the first application is deducing it to [`A|`B]. The question is: why isn't the second application narrowing it using an intersection? [Why isn't the initial deduction simply a bound which is further constrained?) The actual message I got was: File "./lpsrc/flx_lookup.ipk", line 968, characters 19-21: This expression has type Flx_print.felix_term_t but is here used with type Flx_ast.typecode_t A typecode is-a term. -- John Skaller Felix, successor to C++: http://felix.sf.net