[m-dev.] diff: some more type class improvements

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Apr 12 20:02:40 AEST 1998


On 10-Apr-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> On 10-Apr-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > compiler/typecheck.m:
> > 	Ensure that we run a final pass of context reduction at the
> > 	end of typechecking each predicate (or function).
> 
> I think it's worth adding a comment why this is so. Incidently... why is
> this so? ;-) Will there be anything left to reduce if you have been reducing
> at every call?

Yes, because the constraints may have got simpler since the last call.
E.g. if you have the type assignment

	{ X :: int, Y :: T } <= printable(T)

and then there is a unification

	X = Y

then after this unification (note that we don't perform context
reduction after var-var unifications) the type assignment is

	{ X :: int, Y :: int } <= printable(int)

and so we need to perform context reduction to discard the
`printable(int)'.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list