Maintainer | Simon Meier <iridcode@gmail.com> |
---|---|
Safe Haskell | Safe-Inferred |
Document
class allowing to have different interpretations of the
HughesPJ pretty-printing combinators.
- data Doc
- class (Monoid d, NFData d) => Document d where
- isEmpty :: Doc -> Bool
- render :: Doc -> String
- renderStyle :: Style -> Doc -> String
- defaultStyle :: Style
- data Style = Style {
- mode :: Mode
- lineLength :: Int
- ribbonsPerLine :: Float
- data Mode
- = PageMode
- | ZigZagMode
- | LeftMode
- | OneLineMode
- ($--$) :: Document d => d -> d -> d
- emptyDoc :: Document d => d
- (<>) :: Monoid m => m -> m -> m
- semi :: Document d => d
- colon :: Document d => d
- comma :: Document d => d
- space :: Document d => d
- equals :: Document d => d
- lparen :: Document d => d
- rparen :: Document d => d
- lbrack :: Document d => d
- rbrack :: Document d => d
- lbrace :: Document d => d
- rbrace :: Document d => d
- int :: Document d => Int -> d
- integer :: Document d => Integer -> d
- float :: Document d => Float -> d
- double :: Document d => Double -> d
- rational :: Document d => Rational -> d
- quotes :: Document d => d -> d
- doubleQuotes :: Document d => d -> d
- parens :: Document d => d -> d
- brackets :: Document d => d -> d
- braces :: Document d => d -> d
- hang :: Document d => d -> Int -> d -> d
- punctuate :: Document d => d -> [d] -> [d]
- nestBetween :: Document d => Int -> d -> d -> d -> d
- nestShort :: Document d => Int -> d -> d -> d -> d
- nestShort' :: Document d => String -> String -> d -> d
- nestShortNonEmpty :: Document d => Int -> d -> d -> d -> d
- nestShortNonEmpty' :: Document d => String -> String -> d -> d
- fixedWidthText :: Document d => Int -> String -> d
- symbol :: Document d => String -> d
- numbered :: Document d => d -> [d] -> d
- numbered' :: Document d => [d] -> d
Documentation
class (Monoid d, NFData d) => Document d whereSource
zeroWidthText :: String -> dSource
caseEmptyDoc :: d -> d -> d -> dSource
renderStyle :: Style -> Doc -> String
The default Style
.
data Style
Style | |
|
($--$) :: Document d => d -> d -> dSource
Vertical concatentation of two documents with an empty line in between.
(<>) :: Monoid m => m -> m -> m
doubleQuotes :: Document d => d -> dSource
Additional combinators
:: Document d | |
=> Int | Indent of body |
-> d | Leading document |
-> d | Finishing document |
-> d | Body document |
-> d |
Nest a document surrounded by a leading and a finishing document breaking lead, body, and finish onto separate lines, if they don't fit on a single line.
:: Document d | |
=> Int | Indent of body |
-> d | Leading document |
-> d | Finishing document |
-> d | Body document |
-> d |
Nest a document surrounded by a leading and a finishing document with an non-compulsory break between lead and body.
nestShort' :: Document d => String -> String -> d -> dSource
Nest document between two strings and indent body by length lead + 1
.
nestShortNonEmpty :: Document d => Int -> d -> d -> d -> dSource
Like nestShort
but doesn't print the lead and finish, if the document is
empty.
nestShortNonEmpty' :: Document d => String -> String -> d -> dSource
Like nestShort'
but doesn't print the lead and finish, if the document is
empty.
fixedWidthText :: Document d => Int -> String -> dSource
Output text with a fixed width: if it is smaller then nothing happens, otherwise care is taken to make the text appear having the given width.