X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Futils%2FPretty.lhs;h=b873ac70b1886654889959929fc7067624d01f77;hp=0fc817f288a79e260d63952c27b6861a2b0b1084;hb=ad94d40948668032189ad22a0ad741ac1f645f50;hpb=2d52ee06786e5caf0c2d65a4b4bb7c45c6493190 diff --git a/compiler/utils/Pretty.lhs b/compiler/utils/Pretty.lhs index 0fc817f..b873ac7 100644 --- a/compiler/utils/Pretty.lhs +++ b/compiler/utils/Pretty.lhs @@ -87,7 +87,7 @@ Relative to John's original paper, there are the following new features: It is Really Useful in practice. 2. There is a paragraph-fill combinator, fsep, that's much like sep, - only it keeps fitting things on one line until itc can't fit any more. + only it keeps fitting things on one line until it can't fit any more. 3. Some random useful extra combinators are provided. <+> puts its arguments beside each other with a space between them, @@ -152,6 +152,13 @@ Relative to John's original paper, there are the following new features: \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings +-- for details + module Pretty ( Doc, -- Abstract Mode(..), TextDetails(..), @@ -162,7 +169,7 @@ module Pretty ( int, integer, float, double, rational, parens, brackets, braces, quotes, doubleQuotes, semi, comma, colon, space, equals, - lparen, rparen, lbrack, rbrack, lbrace, rbrace, + lparen, rparen, lbrack, rbrack, lbrace, rbrace, cparen, (<>), (<+>), hcat, hsep, ($$), ($+$), vcat, @@ -446,7 +453,7 @@ int n = text (show n) integer n = text (show n) float n = text (show n) double n = text (show n) -rational n = text (show (fromRat n)) +rational n = text (show (fromRat n :: Double)) --rational n = text (show (fromRationalX n)) -- _showRational 30 n) quotes p = char '`' <> p <> char '\'' @@ -455,6 +462,8 @@ parens p = char '(' <> p <> char ')' brackets p = char '[' <> p <> char ']' braces p = char '{' <> p <> char '}' +cparen True = parens +cparen False = id hcat = foldr (<>) empty hsep = foldr (<+>) empty @@ -1022,11 +1031,7 @@ printDoc mode hdl doc -- some versions of hPutBuf will barf if the length is zero hPutLitString handle a# 0# = return () hPutLitString handle a# l# -#if __GLASGOW_HASKELL__ < 411 - = hPutBuf handle (A# a#) (I# l#) -#else = hPutBuf handle (Ptr a#) (I# l#) -#endif -- Printing output in LeftMode is performance critical: it's used when -- dumping C and assembly output, so we allow ourselves a few dirty @@ -1066,9 +1071,4 @@ layLeft b (TextBeside s sl p) = put b s >> layLeft b p put b (Str s) = bPutStr b s put b (PStr s) = bPutFS b s put b (LStr s l) = bPutLitString b s l - -#if __GLASGOW_HASKELL__ < 503 -hPutBuf = hPutBufFull -#endif - \end{code}