Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type indexed types?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Type indexed types?
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