English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2005-01-25 (17:50)
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 
	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