[GHC] #9392: "\n" is displayed weirdly in error messages

#9392: "\n" is displayed weirdly in error messages -------------------------------------+------------------------------------- Reporter: Artyom.Kazak | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Other Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9392 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9392: "\n" is displayed weirdly in error messages -------------------------------------+------------------------------------- Reporter: | Owner: Artyom.Kazak | Status: new Type: bug | Milestone: Priority: low | Version: 7.8.3 Component: Compiler | Keywords: newcomer Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Other | Related Tickets: #9681 Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => newcomer * related: => #9681 Comment: The problem with a newline at the end of a string was fixed in #9681, slated for GHC 7.10.1. Let's leave this issue open for the formatting issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9392#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9392: "\n" is displayed weirdly in error messages -------------------------------------+------------------------------------- Reporter: | Owner: jlengyel Artyom.Kazak | Status: new Type: bug | Milestone: Priority: low | Version: 7.8.3 Component: Compiler | Keywords: newcomer Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Other | Related Tickets: #9681 Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by jlengyel): * owner: => jlengyel -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9392#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9392: "\n" is displayed weirdly in error messages -------------------------------------+------------------------------------- Reporter: | Owner: Artyom.Kazak | Status: new Type: bug | Milestone: Priority: low | Version: 7.8.3 Component: Compiler | Keywords: newcomer Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Other | Related Tickets: #9681 Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by jlengyel): * owner: jlengyel => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9392#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9392: "\n" is displayed weirdly in error messages -------------------------------------+------------------------------------- Reporter: Artyom.Kazak | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9681 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): The formatting is intentional, see #4436. It would be nice to use the original syntax, though (and set the "original syntax" of a quasiquoter to use the multiline thing). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9392#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9392: "\n" is displayed weirdly in error messages -------------------------------------+------------------------------------- Reporter: Artyom.Kazak | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9681 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * keywords: newcomer => * type: bug => feature request Comment: @Artyom.Kazak: what exactly do you find weird about the current error message? The printing over multiple lines, or just the extra slashes that are added. Perhaps the following would be an improvement: {{{ In the expression: "a\n b" + () }}} Replying to [comment:4 rwbarton]:
The formatting is intentional, see #4436. It would be nice to use the original syntax, though (and set the "original syntax" of a quasiquoter to use the multiline thing).
To show the exception from #4436, the following code path is used: `TcSplice.runMeta -> Outputable.ppr -> (instance Outputable HsLit) -> Outputable.pprHsString -> GHC.Show.showMultiLineString` I don't see an easy way to make the change you propose. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9392#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC