Skip to content

The text "Possible fix: add an instance declaration for ..." is redundant and not usually helpful

The current state of affairs: Given a typical type error, for example

"a" + "b"

we get

    No instance for (Num [Char])
      arising from a use of `+'
    Possible fix: add an instance declaration for (Num [Char])
    In the expression: "a" + "b"
    In an equation for `it': it = "a" + "b"

I'm concerned with the third line here:

  1. It is redundant, for it just repeats information from the first line. In my experience, the redundancy sometimes hinders usability, namely, when the types get very long, visually burying the problematic expression.

  2. Furthermore it is often misleading: Everyday type errors stem from incorrect usage of a library, not from missing bits of a library. The line tends to be confusing especially for new users: the only ones who might have profited from the redundancy.

  3. To expand a bit on (1): An imported bit of information in the type error is the fact that the type mismatch lies in the application of (+) to "a". The user gains this information by combination of lines 2 and 4. It is incovenient that line 3 visually seperates those lines.

I propose that the problematic line be simply removed.

Trac metadata
Trac field Value
Version 7.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information