X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Text%2FPrettyPrint%2FHughesPJ.hs;h=2b983a518f7459dea855ccde66453373fef9ff92;hb=719e2b47e2771c36c0e452a919420178ba474d94;hp=3585cebf1d15f3df13f97f6d674fef23740520df;hpb=a2c8341860391197319ceef06b0a00fcccbac109;p=ghc-base.git diff --git a/Text/PrettyPrint/HughesPJ.hs b/Text/PrettyPrint/HughesPJ.hs index 3585ceb..2b983a5 100644 --- a/Text/PrettyPrint/HughesPJ.hs +++ b/Text/PrettyPrint/HughesPJ.hs @@ -251,7 +251,7 @@ rational :: Rational -> Doc parens :: Doc -> Doc; -- ^ Wrap document in @(...)@ brackets :: Doc -> Doc; -- ^ Wrap document in @[...]@ braces :: Doc -> Doc; -- ^ Wrap document in @{...}@ -quotes :: Doc -> Doc; -- ^ Wrap document in @'...'@ +quotes :: Doc -> Doc; -- ^ Wrap document in @\'...\'@ doubleQuotes :: Doc -> Doc; -- ^ Wrap document in @\"...\"@ -- Combining @Doc@ values @@ -263,6 +263,7 @@ hsep :: [Doc] -> Doc; -- ^List version of '<+>' ($$) :: Doc -> Doc -> Doc; -- ^Above; if there is no -- overlap it \"dovetails\" the two +($+$) :: Doc -> Doc -> Doc; -- ^Above, without dovetailing. vcat :: [Doc] -> Doc; -- ^List version of '$$' cat :: [Doc] -> Doc; -- ^ Either hcat or vcat @@ -412,7 +413,7 @@ rational n = text (show n) -- SIGBJORN wrote instead: -- rational n = text (show (fromRationalX n)) -quotes p = char '`' <> p <> char '\'' +quotes p = char '\'' <> p <> char '\'' doubleQuotes p = char '"' <> p <> char '"' parens p = char '(' <> p <> char ')' brackets p = char '[' <> p <> char ']' @@ -875,8 +876,10 @@ easy_display nl_text txt end doc lay (NilAbove p) no_doc = nl_text `txt` lay p cant_fail -- NoDoc always on first line lay (TextBeside s sl p) no_doc = s `txt` lay p no_doc -indent n | n >= 8 = '\t' : indent (n - 8) - | otherwise = spaces n +-- OLD version: we shouldn't rely on tabs being 8 columns apart in the output. +-- indent n | n >= 8 = '\t' : indent (n - 8) +-- | otherwise = spaces n +indent n = spaces n multi_ch 0 ch = "" multi_ch n ch = ch : multi_ch (n - 1) ch @@ -910,4 +913,4 @@ spaces n | n <= 0 = "" (TextDetails_Chr 'a') 1 (Doc_NilAbove (Doc_Nest (-5) (Doc_TextBeside (TextDetails_Chr 'a') 1 (Doc_NilAbove (Doc_Nest (-5) (Doc_TextBeside (TextDetails_Chr 'a') 1 Doc_Empty))))))))))) (Doc_NilAbove (Doc_Nest --} \ No newline at end of file +-}