GHC can suggest "Probable fixes" that are impossible
|Reported by:||glasser@…||Owned by:|
|Type of failure:||Test Case:|
|Related Tickets:||Differential Revisions:|
Let's say I type in ["foo", 4] to GHCI:
Prelude> ["foo", 4]
No instance for (Num [Char])
arising from the literal `4' at <interactive>:1:8
Probable fix: add an instance declaration for (Num [Char]) In the list element: 4 In the definition of `it': it = ["foo", 4]
It suggests a "Probable fix": add an instance declaration for (Num [Char]). OK, great. However, as soon as I try to evaluate "instance Num [Char] where" I get
Illegal instance declaration for `Num [Char]'
(The instance type must be of form (T a b c)
where T is not a synonym, and a,b,c are distinct type variables)
In the instance declaration for `Num [Char]'
Now, I'm not enough of an expert on the type class system to know if this means that it's absolutely impossible to declare instances on [Char], but it certainly seems like that. Thus, the "Probable fix" is in error, since [Char] can't get a Num instance. (Though I guess (Num a) => [a] can, so maybe this whole issue is a little moot.)