Type-checker bug

Jeffrey R Lewis jeff@galconn.com
Fri, 7 Dec 2001 10:24:52 -0800


On Wednesday 24 October 2001 05:13 am, John Hughes wrote:
> The program below produces this error message (with -98 in the February
> 2001 version):
>
> ERROR Bug.hs:5 - Instance of Num Int required for definition of f
>
> Pardon?
>
> data T
> class C a b | b->a where m :: a -> (Bool, b)
> instance C Int T
> instance C a b => C [a] [b]
> f () = located :: [T]
>   where (_,located) = m [0]

Using generic instances with functional dependencies isn't fully supported in 
Hugs.  Many people have reported bugs that are a result of this.  Fixing it, 
however, looks to involve a significant overhaul of context simplification, 
an exercise I've managed to put off doing for quite some time ;-)

But for this particular bug, I have a patch that may get you some mileage.  
It will be in the upcoming release.

--Jeff