diff --git a/Text/PrettyPrint/HughesPJ.hs b/Text/PrettyPrint/HughesPJ.hs index d5d68c184e9600900877b6b27e201fc0ece89ad8..b50222364575811d004501d2fb9418c6e303668b 100644 --- a/Text/PrettyPrint/HughesPJ.hs +++ b/Text/PrettyPrint/HughesPJ.hs @@ -173,8 +173,9 @@ module Text.PrettyPrint.HughesPJ ( Doc, -- Abstract -- * Constructing documents + -- ** Converting values into documents - char, text, ptext, zeroWidthText, + char, text, ptext, sizedText, zeroWidthText, int, integer, float, double, rational, -- ** Simple derived documents @@ -265,6 +266,9 @@ instance IsString Doc where -- | An obsolete function, now identical to 'text'. ptext :: String -> Doc +-- | Some text with any width. (@text s = sizedText (length s) s@) +sizedText :: Int -> String -> Doc + -- | Some text, but without any width. Use for non-printing text -- such as a HTML or Latex tags zeroWidthText :: String -> Doc @@ -621,7 +625,8 @@ isEmpty _ = False char c = textBeside_ (Chr c) 1 Empty text s = case length s of {sl -> textBeside_ (Str s) sl Empty} ptext s = case length s of {sl -> textBeside_ (PStr s) sl Empty} -zeroWidthText s = textBeside_ (Str s) 0 Empty +sizedText l s = textBeside_ (Str s) l Empty +zeroWidthText = sizedText 0 nest k p = mkNest k (reduceDoc p) -- Externally callable version diff --git a/pretty.cabal b/pretty.cabal index e32fe449516c8b50553cc9e04c994b0316c027e8..b4eb6f5f136cfa2401471ebcaf75e1594502780b 100644 --- a/pretty.cabal +++ b/pretty.cabal @@ -1,5 +1,5 @@ name: pretty -version: 1.0.1.2 +version: 1.0.2.0 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org