X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Futils%2FPretty.lhs;h=985666d0132e6495ae3c43d6ba6115ddab808897;hb=26741ec416bae2c502ef00a2ba0e79050a32cb67;hp=31bad8120608818d25b31c4c9cf24167d5cf7ba4;hpb=7d61cb61daa5e433a0cb85b34b7f0c58b2f961ff;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/Pretty.lhs b/ghc/compiler/utils/Pretty.lhs index 31bad81..985666d 100644 --- a/ghc/compiler/utils/Pretty.lhs +++ b/ghc/compiler/utils/Pretty.lhs @@ -12,7 +12,7 @@ #endif module Pretty ( - Pretty(..), + SYN_IE(Pretty), #if defined(COMPILING_GHC) prettyToUn, @@ -25,28 +25,27 @@ module Pretty ( #endif ppSP, pp'SP, ppLbrack, ppRbrack, ppLparen, ppRparen, ppSemi, ppComma, ppEquals, - ppBracket, ppParens, + ppBracket, ppParens, ppQuote, ppCat, ppBeside, ppBesides, ppAbove, ppAboves, ppNest, ppSep, ppHang, ppInterleave, ppIntersperse, ppShow, speakNth, #if defined(COMPILING_GHC) - ppAppendFile, + ppPutStr, #endif -- abstract type, to complete the interface... - PrettyRep(..), CSeq, Delay -#if defined(COMPILING_GHC) - , Unpretty(..) -#endif + PrettyRep(..), Delay ) where #if defined(COMPILING_GHC) CHK_Ubiq() -- debugging consistency check +IMPORT_1_3(Ratio) +IMPORT_1_3(IO) -import Unpretty ( Unpretty(..) ) +import Unpretty ( SYN_IE(Unpretty) ) #endif import CharSeq @@ -94,7 +93,7 @@ ppNest :: Int -> Pretty -> Pretty ppShow :: Int -> Pretty -> [Char] #if defined(COMPILING_GHC) -ppAppendFile :: _FILE -> Int -> Pretty -> IO () +ppPutStr :: Handle -> Int -> Pretty -> IO () #endif \end{code} @@ -129,9 +128,9 @@ ppShow width p MkPrettyRep seq ll emp sl -> cShow seq #if defined(COMPILING_GHC) -ppAppendFile f width p +ppPutStr f width p = case (p width False) of - MkPrettyRep seq ll emp sl -> cAppendFile f seq + MkPrettyRep seq ll emp sl -> cPutStr f seq #endif ppNil width is_vert = MkPrettyRep cNil (MkDelay 0) True (width >= 0) @@ -150,6 +149,7 @@ ppInt n width is_vert = MkPrettyRep (cStr s) (MkDelay ls) False (width >= ls) ppInteger n = ppStr (show n) ppDouble n = ppStr (show n) ppFloat n = ppStr (show n) + ppRational n = ppStr (show (fromRationalX n)) -- _showRational 30 n) ppSP = ppChar ' ' @@ -164,6 +164,7 @@ ppEquals = ppChar '=' ppBracket p = ppBeside ppLbrack (ppBeside p ppRbrack) ppParens p = ppBeside ppLparen (ppBeside p ppRparen) +ppQuote p = ppBeside (ppChar '`') (ppBeside p (ppChar '\'')) ppInterleave sep ps = ppSep (pi ps) where