]>
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