Skip to content

Printing of "\n" in error messages is broken

The code excerpts in error messages from GHC 7.8.3 are misformatted when the original code contains the string "\n" - the \n escape is simply lost. Example with GHCi:

Prelude> 1+"\n"

<interactive>:2:2:
    No instance for (Num [Char]) arising from a use of `+'
    In the expression: 1 + ""
    In an equation for `it': it = 1 + ""

The printing of the string "\n " is also strangely formatted, although technically equivalent:

Prelude> 1+"\n "

<interactive>:3:2:
    No instance for (Num [Char]) arising from a use of `+'
    In the expression:
      1
      + "\n\
        \ "
    In an equation for `it':
        it
          = 1
            + "\n\
              \ "
Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC oerjan@nvg.org
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information