X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FOutputable.lhs;h=37f116cfe0e31717c13e9eb0706e47237629832a;hb=98bef4db89b57b01c8f557a027dbeb8ae72407c9;hp=73c6bd3fc2a623aee4a1f4813ef92564ae246c4c;hpb=e95ee1f718c6915c478005aad8af81705357d6ab;p=ghc-hetmet.git diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index 73c6bd3..37f116c 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -75,14 +75,24 @@ import Pretty ( Doc, Mode(..) ) import Panic import Data.Char -import Data.Map (Map) import qualified Data.Map as M +import qualified Data.IntMap as IM 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} + %************************************************************************ %* * \subsection{The @PprStyle@ data type} @@ -567,8 +577,10 @@ instance Outputable FastString where ppr fs = ftext fs -- Prints an unadorned string, -- no double quotes or anything -instance (Outputable key, Outputable elt) => Outputable (Map key elt) where +instance (Outputable key, Outputable elt) => Outputable (M.Map key elt) where ppr m = ppr (M.toList m) +instance (Outputable elt) => Outputable (IM.IntMap elt) where + ppr m = ppr (IM.toList m) \end{code} %************************************************************************ @@ -606,7 +618,7 @@ pprHsChar c | c > '\x10ffff' = char '\\' <> text (show (fromIntegral (ord c) :: -- | 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