diff options
author | Thomas Schilling <nominolo@googlemail.com> | 2011-04-03 21:26:27 +0100 |
---|---|---|
committer | Thomas Schilling <nominolo@googlemail.com> | 2011-04-03 21:26:27 +0100 |
commit | d637f9bc79e075f046843906900c03a2121d67f2 (patch) | |
tree | 5fa78812cc79fc372e30546079a901535da1bbc8 /compiler/utils/Pretty.lhs | |
parent | 99d5f7632941b110a14aa760ab464ee7737f27ae (diff) | |
download | haskell-d637f9bc79e075f046843906900c03a2121d67f2.tar.gz |
Add zeroWidthText to Pretty.
Diffstat (limited to 'compiler/utils/Pretty.lhs')
-rw-r--r-- | compiler/utils/Pretty.lhs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/utils/Pretty.lhs b/compiler/utils/Pretty.lhs index a518c0b6f6..f0ca69cbb9 100644 --- a/compiler/utils/Pretty.lhs +++ b/compiler/utils/Pretty.lhs @@ -163,7 +163,7 @@ module Pretty ( empty, isEmpty, nest, - char, text, ftext, ptext, + char, text, ftext, ptext, zeroWidthText, int, integer, float, double, rational, parens, brackets, braces, quotes, doubleQuotes, semi, comma, colon, space, equals, @@ -224,6 +224,10 @@ The primitive @Doc@ values \begin{code} empty :: Doc isEmpty :: Doc -> Bool +-- | Some text, but without any width. Use for non-printing text +-- such as a HTML or Latex tags +zeroWidthText :: String -> Doc + text :: String -> Doc char :: Char -> Doc @@ -560,6 +564,7 @@ ftext s = case iUnbox (lengthFS s) of {sl -> textBeside_ (PStr s) sl Empty} ptext :: LitString -> Doc ptext s_= case iUnbox (lengthLS s) of {sl -> textBeside_ (LStr s sl) sl Empty} where s = {-castPtr-} s_ +zeroWidthText s = textBeside_ (Str s) (_ILIT(0)) Empty #if defined(__GLASGOW_HASKELL__) -- RULE that turns (text "abc") into (ptext (A# "abc"#)) to avoid the |