[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / ghc / compiler / utils / Pretty.lhs
index 5875f03..ad2a76f 100644 (file)
 #endif
 
 module Pretty (
-       Pretty(..),
 
 #if defined(COMPILING_GHC)
+       SYN_IE(Pretty),
        prettyToUn,
+#else
+       Pretty,
 #endif
        ppNil, ppStr, ppPStr, ppChar, ppInt, ppInteger,
        ppFloat, ppDouble,
@@ -25,28 +27,29 @@ 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) )
+#else
+import Ratio
 #endif
 
 import CharSeq
@@ -94,7 +97,7 @@ ppNest                :: Int -> Pretty -> Pretty
 ppShow         :: Int -> Pretty -> [Char]
 
 #if defined(COMPILING_GHC)
-ppAppendFile   :: _FILE -> Int -> Pretty -> PrimIO ()
+ppPutStr       :: Handle -> Int -> Pretty -> IO ()
 #endif
 \end{code}
 
@@ -129,9 +132,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 +153,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 +168,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