Type-checker bug related to implicit parameters.

Sigbjorn Finne sof@galconn.com
Wed, 19 Sep 2001 10:39:24 -0700


I believe if you're (more) explicit about the scope
of the scoped type variable, you'll be fine. i.e.,

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

i.e., 'foo' is running into the same issue as the bug
reported in
http://haskell.cs.yale.edu/pipermail/hugs-bugs/2001-January/000084.html,
(which has been marked as 'fixable' by the Hugs developers,
but not yet tackled).

--sigbjorn

----- Original Message -----
From: "John Hughes" <rjmh@cs.chalmers.se>
To: <hugs-bugs@haskell.org>
Sent: Wednesday, September 19, 2001 10:00
Subject: Type-checker bug related to implicit parameters.


>
> 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
>
> _______________________________________________
> Hugs-Bugs mailing list
> Hugs-Bugs@haskell.org
> http://www.haskell.org/mailman/listinfo/hugs-bugs