Type-checker bug related to implicit parameters.

John Hughes rjmh@cs.chalmers.se
Wed, 19 Sep 2001 19:00:28 +0200 (MET DST)


Hugs -98 (Feb 2001) rejects the following program (which should be well-typed)

> foo :: ((?x :: Int) => b) -> Int -> b
> foo s z = s with ?x = z

with the message

ERROR Bug.hs:2 - Inferred type is not general enough
*** Expression    : foo
*** Expected type : ((?x :: Int) => a) -> Int -> a
*** Inferred type : ((?x :: Int) => a) -> Int -> Int

It seems to unify the type of the implicit parameter with the type of
the result.

GHC accepts this program (but generates wrong code).

John Hughes