[project @ 2001-09-14 15:53:41 by sewardj]
[ghc-hetmet.git] / ghc / compiler / utils / Outputable.lhs
index 165ce03..7aa2461 100644 (file)
@@ -17,6 +17,7 @@ module Outputable (
        ifPprDebug, unqualStyle,
 
        SDoc,           -- Abstract
+       docToSDoc,
        interppSP, interpp'SP, pprQuotedList, pprWithCommas,
        empty, nest,
        text, char, ptext,
@@ -224,6 +225,9 @@ showSDocDebug d = show (d PprDebug)
 \end{code}
 
 \begin{code}
+docToSDoc :: Doc -> SDoc
+docToSDoc d = \_ -> d
+
 empty sty      = Pretty.empty
 text s sty     = Pretty.text s
 char c sty     = Pretty.char c
@@ -371,8 +375,8 @@ showCharLit c rest
 -- of Char and String.
 
 pprHsChar :: Int -> SDoc
-pprHsChar c | not (inCharRange c) = char '\\' <> show (fromIntegral c :: Word32)
-            | otherwise = text (show (chr c))
+pprHsChar c | c > 0x10ffff = char '\\' <> text (show (fromIntegral c :: Word32))
+            | otherwise    = text (show (chr c))
 
 pprHsString :: FastString -> SDoc
 pprHsString fs = text (show (unpackFS fs))