Skip to content
Snippets Groups Projects
Commit e985cee6 authored by Christian.Maeder@dfki.de's avatar Christian.Maeder@dfki.de
Browse files

added sizedText

parent 2bc029c7
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
name: pretty
version: 1.0.1.2
version: 1.0.2.0
license: BSD3
license-file: LICENSE
maintainer: libraries@haskell.org
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment