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 0EA64BC8C for ; Tue, 25 Jan 2005 18:50:01 +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 j0PHo0bC007931 for ; Tue, 25 Jan 2005 18:50: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 SAA31790 for ; Tue, 25 Jan 2005 18:49: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 j0PHnv7H007894 for ; Tue, 25 Jan 2005 18:49: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 j0PHnq88097990; Wed, 26 Jan 2005 04:19:52 +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: <1106673863.28636.42.camel@pelican.wigram> References: <20050125122849.GB15086@draco.xyxyx.org> <1106672472.28636.20.camel@pelican.wigram> <1106673863.28636.42.camel@pelican.wigram> Content-Type: text/plain Message-Id: <1106675391.28636.54.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 26 Jan 2005 04:49:52 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41F686C8.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41F686C5.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 wrote:01 unification:01 argg:01 mismatch:01 unifying:01 glebe:01 061:98 nsw:01 pair:01 snail:02 2037:02 equation:02 equation:02 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: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 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