Bug? Or at least a better error message?

Geoffrey Alan Washburn geoffw at cis.upenn.edu
Mon Jun 5 10:47:33 EDT 2006


Brian Hulley wrote:

> I must admit I can't understand where the ambiguity actually is.
> bar has been defined as a -> Int, so surely anything on the rhs of an 
> equation for an instance of the bar method in Foo is therefore an Int 
> also, so having to explicitly write 1::Int seems superfluous.
> 
>       bar([x]) = 1    -- why is ::Int needed when we know that bar:: 
> a->Int ???

	I haven't tested the combination where I omit the annotation on 
"bar([x]) = 1", but I believe that the annotation is only actualyl 
necessary for the "bar [] = bar [1]" case where ghc cannot determine the 
type at which it needs to be calling bar recursively.



More information about the Glasgow-haskell-users mailing list