[commit: base] master: Fix Trac #7146, by displaying a "\n" in a multi-line string (6fb7bf8)
Simon Peyton Jones
simonpj at microsoft.com
Wed Aug 15 15:31:09 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/6fb7bf8c9ba2a53d718a0d2a5f9e0f78cb7faf8f
>---------------------------------------------------------------
commit 6fb7bf8c9ba2a53d718a0d2a5f9e0f78cb7faf8f
Author: Simon Peyton Jones <simonpj at 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
More information about the Cvs-libraries
mailing list