From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 9DB9DBC8C for ; Tue, 25 Jan 2005 19:37:00 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0PIb0UN013192 for ; Tue, 25 Jan 2005 19:37:00 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA32599 for ; Tue, 25 Jan 2005 19:36:59 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0PIavbG013187 for ; Tue, 25 Jan 2005 19:36:58 +0100 Received: from [192.168.1.200] (ppp205-248.lns1.syd3.internode.on.net [203.122.205.248]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j0PIam88006593; Wed, 26 Jan 2005 05:06:48 +1030 (CST) Subject: Re: [Caml-list] Type indexed types? From: skaller Reply-To: skaller@users.sourceforge.net To: Jim Farrand Cc: caml-list In-Reply-To: <1106675391.28636.54.camel@pelican.wigram> References: <20050125122849.GB15086@draco.xyxyx.org> <1106672472.28636.20.camel@pelican.wigram> <1106673863.28636.42.camel@pelican.wigram> <1106675391.28636.54.camel@pelican.wigram> Content-Type: text/plain Message-Id: <1106678207.28636.98.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 26 Jan 2005 05:36:47 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41F691CC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41F691C9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 wrote:01 wrote:01 unification:01 argg:01 argg:01 bug:01 mismatch:01 unifying:01 glebe:01 061:98 nsw:01 pair:01 pair:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Wed, 2005-01-26 at 04:49, skaller wrote: > On Wed, 2005-01-26 at 04:24, skaller wrote: > > > > > However, when we're trying to order all the match > > candidates, it would be nicer to get one of the > > above four results in one unification step. > > Argg .. sorry for answering my own post, > but now it is obvious how to do it. > > 1) Set the result to Equal > > 2) if you have an equation > > 'a = T > or > T = 'a > > where T is not a type variable, and then: > > if the current result is Equal reset it > to 'less' or 'greater' depending which side > of the original pair of terms 'a is on, > > otherwise return Incomparable Argg .. bug .. this should read: otherwise if the result is not 'less' or 'greater' consistent with which side of the original pair 'a is on, return incomparable (otherwise continue) > > 3) if you get a mismatch, return Incomparable > > 4) Otherwise you have an equation between > two type variables, which doesn't change > the current result > > Provided you haven't returned incomparable, > you continue unifying in the usual way, > returning the result when the MGU is found. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net