#7146: Literal strings printed wrong -------------------------------+-------------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.4.2 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by simonpj):
* status: new => closed * resolution: => fixed Comment: Fixed by {{{ commit 6fb7bf8c9ba2a53d718a0d2a5f9e0f78cb7faf8f Author: Simon Peyton Jones <simo...@microsoft.com> Date: Wed Aug 15 14:23:22 2012 +0100 Fix Trac #7146, by displaying a "\n" in a multi-line string >--------------------------------------------------------------- GHC/Show.lhs | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GHC/Show.lhs b/GHC/Show.lhs index e3148cd..859c2fe 100644 --- a/GHC/Show.lhs +++ b/GHC/Show.lhs @@ -390,12 +390,12 @@ showMultiLineString :: String -> [String] -- * break the string into multiple lines -- * wrap the entire thing in double quotes -- Example: @showMultiLineString "hello\ngoodbye\nblah"@ --- returns @["\"hello\\", "\\goodbye\\", "\\blah\""]@ +-- returns @["\"hello\\n\\", "\\goodbye\n\\", "\\blah\""]@ showMultiLineString str = go '\"' str where go ch s = case break (== '\n') s of - (l, _:s'@(_:_)) -> (ch : showLitString l "\\") : go '\\' s' + (l, _:s'@(_:_)) -> (ch : showLitString l "\\n\\") : go '\\' s' (l, _) -> [ch : showLitString l "\""] isDec :: Char -> Bool }}} There are a couple of testsuite stdout-changes in consequence, so I'm not making another test. I'm not sure this is worth merging. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7146#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs