Hi John,
I've been off the Hugs maintainers team since the beginning of the year,
but since nobody else had responded to this, I thought I'd take a look:
| The following program
|
| type A = (a :: Integer)
| x = (a=2) :: Rec A
|
| produces the error message
|
| ERROR "Junk.hs" (line 2): Type error in type annotation
| *** Term : (a=2)
| *** Type : Rec (a :: a)
| *** Does not match : Rec A
| *** Because : rows are not compatible
|
| which is strange to say the least!
The problem here is that you've upset Hugs by using a derogatory name
for the input file (i.e., "Junk.hs") which has caused Hugs to take affront,
and hence to display the error message seen here. Try using a different
filename (e.g., "Nice.hs"), and Hugs should respond more favorably.
:-)
Well, ok, maybe not ... but my suggested fix may seem just as strange to
you. Look for the code that generates the error message shown above and
delete it. You'll find this on about line 1092 of subst.c in the Feb 2000
release of Hugs. Instead of deleting it, I commented it out, resulting in:
}/* else {
unifyFails = "rows are not compatible";
return FALSE;
}*/
Hopefully this should be enough for you to locate and fix the bug without
making up a proper diff. The code here was a well-intentioned attempt to
give a more accurate diagnostic during unification. Alas, it inadvertently
short-circuited the part of the unification code that handles synonym
expansion, and so resulted in the problem that you have described here.
Hope this helps,
Mark
PS. Thanks to Ross for pointing out the EmptyRow constructor in response
to your other question. The syntax of the Trex code isn't particularly
satisfactory --- this being a good example --- but we were constrained by
the way that some of the symbols we really wanted are used elsewhere in the
language. I think a cleaner syntax could be found if one were prepared to
sacrifice compatibility with Haskell 98. Simon PJ and I wrote a paper that
suggested one such alternative; "Lightweight records for Haskell", from the
Haskell workshop in 1999.