"\n" is displayed weirdly in error messages
Observe:
Prelude> "a\nb" + ()
<interactive>:2:10:
Couldn't match expected type ‘[Char]’ with actual type ‘()’
In the second argument of ‘(+)’, namely ‘()’
In the expression:
"a\n\
\b"
+ ()
Moreover, if “\n” is at the end of the string, it simply gets eaten:
Prelude> "a\n" + ()
<interactive>:3:9:
Couldn't match expected type ‘[Char]’ with actual type ‘()’
In the second argument of ‘(+)’, namely ‘()’
In the expression: "a" + ()
It happens in GHC as well as GHCi. Tested on 7.8.3.
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | low |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |