For type error involving inferred types, show source of the type
Consider the code:
module TestTypes where a = 42 b = a ++ "hello"
The type Error is (ghc-8.2.1):
TestTypes.hs:3:5: error: • No instance for (Num [Char]) arising from the literal ‘42’ • In the expression: 42 In an equation for ‘a’: a = 42 | 3 | a = 42 | ^^
Actually, the real mistake is in line 5, where
a is inferred as of type
[Char], while it was not meant to. But that location is not reported to the error. As you can guess, in real code location where the unexpected type is inferred for a binding is not that obvious to find.
Suggestion: track locations where bindings' types are inferred, and in case of type error involvin the bindings, add them to the "Relevant bindings" section, or otherwise show it.