Better error messages for Num Literals
This is the official ticket for improving Num literal error messages, corresponding to discussion in the error-messages repo here
The essential scenario is that for the following piece of code:
x :: String
x = 5
We want to change the error message from this:
<interactive>:2:18: error:
• No instance for (Num String) arising from the literal ‘5’
• In the expression: 5
In an equation for ‘x’: x = 5
To this:
<interactive>:2:18: error:
• Expected a value of type `String`, but got a number literal
• No instance for (Num String) arising from the literal ‘5’
• This would be accepted if there were an `instance Num String',
but you probably do not want to make this orphan instance for a type
you did not define
• In the expression: 5
In an equation for ‘x’: x = 5
Noting that the words: but you probably do not want to make this orphan instance for a type you did not define
is only conditionally added whenever the missing instance includes only types defined outside the current package
Hopefully I've defined this ticket correctly! I'm happy to make clarifying edits if needed! Thanks