Use new showMultiLineString to fix Trac #4436
authorsimonpj@microsoft.com <unknown>
Mon, 25 Oct 2010 15:12:36 +0000 (15:12 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 25 Oct 2010 15:12:36 +0000 (15:12 +0000)
There is an accompanying patch for libraries
    base
    template-haskell

compiler/utils/Outputable.lhs

index ed02ab6..37f116c 100644 (file)
@@ -80,9 +80,19 @@ import qualified Data.IntMap as IM
 import Data.Word
 import System.IO       ( Handle, stderr, stdout, hFlush )
 import System.FilePath
 import Data.Word
 import System.IO       ( Handle, stderr, stdout, hFlush )
 import System.FilePath
+
+
+#if __GLASGOW_HASKELL__ >= 700
+import GHC.Show                ( showMultiLineString )
+#else
+showMultiLineString :: String -> [String]
+-- Crude version
+showMultiLineString s = [s]
+#endif
 \end{code}
 
 
 \end{code}
 
 
+
 %************************************************************************
 %*                                                                     *
 \subsection{The @PprStyle@ data type}
 %************************************************************************
 %*                                                                     *
 \subsection{The @PprStyle@ data type}
@@ -608,7 +618,7 @@ pprHsChar c | c > '\x10ffff' = char '\\' <> text (show (fromIntegral (ord c) ::
 
 -- | Special combinator for showing string literals.
 pprHsString :: FastString -> SDoc
 
 -- | Special combinator for showing string literals.
 pprHsString :: FastString -> SDoc
-pprHsString fs = text (show (unpackFS fs))
+pprHsString fs = vcat (map text (showMultiLineString (unpackFS fs)))
 
 ---------------------
 -- Put a name in parens if it's an operator
 
 ---------------------
 -- Put a name in parens if it's an operator