[cvs-nhc98] Remove bug in type checker and addition of some error mess

Olaf Chitil olaf@sparud.net
Thu, 20 Feb 2003 19:23:30 +0100 (CET)


olaf: Thu Feb 20 19:23:30 CET 2003

Update of /usr/src/master/nhc/src/hat/lib
In directory hinken:/tmp/cvs-serv12039/src/hat/lib

Modified Files:
	PreludeBasic.hs 
Log Message:
Remove bug in type checker and addition of some error messages.

Type unification in TypeUnify was wrong!
Given two types c t1 ... tn and c s1 ... sn unification would just unify the two list of arguments. However, if c is a type synonym, this is wrong! A type synonym always has to be expanded. Example:

type T a = Int

Then unifying T Bool and T Int should not force unification of Bool and Int!

With the removal of this bug the Hat transformed Prelude type checks again in nhc98 (instead of producing obscure error "The class Main.Integral has no instance for the type Hat.Hat.List.")



Also extended error message "The class ... has no instance for the type ..." so that it gives additional position information.

Furthermore the renamer (defineDefaultMethod) did fall over if a method was also declared outside of the class. Now an appropriate error message is produced.