| Copyright | (c) Henry J. Wylde, 2015 |
|---|---|
| License | BSD3 |
| Maintainer | public@hjwylde.com |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Language.Qux.PrettyPrinter
Description
Text.PrettyPrint instances and rendering functions for Qux language elements.
To render a program, call: render $ pPrint program
- class Pretty a where
- pPrintPrec :: PrettyLevel -> Rational -> a -> Doc
- pPrint :: a -> Doc
- pPrintList :: PrettyLevel -> [a] -> Doc
- data Style :: * = Style {
- mode :: Mode
- lineLength :: Int
- ribbonsPerLine :: Float
- data Mode :: *
- render :: Doc -> String
- renderStyle :: Style -> Doc -> String
- renderOneLine :: Doc -> String
Types
class Pretty a where
Pretty printing class. The precedence level is used in a similar way as in
the Show class. Minimal complete definition is either pPrintPrec or
pPrint.
Minimal complete definition
Instances
| Pretty Bool | |
| Pretty Char | |
| Pretty Double | |
| Pretty Float | |
| Pretty Int | |
| Pretty Integer | |
| Pretty Ordering | |
| Pretty () | |
| Pretty a => Pretty [a] | |
| Pretty a => Pretty (Maybe a) | |
| (Pretty a, Pretty b) => Pretty (Either a b) | |
| (Pretty a, Pretty b) => Pretty (a, b) | |
| (Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) | |
| (Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) => Pretty (a, b, c, d, e, f, g, h) |
data Style :: *
A rendering style.
Constructors
| Style | |
Fields
| |
data Mode :: *
Rendering mode.
Constructors
| PageMode | Normal |
| ZigZagMode | With zig-zag cuts |
| LeftMode | No indentation, infinitely long lines |
| OneLineMode | All on one line |
Rendering
renderStyle :: Style -> Doc -> String
Render the Doc to a String using the given Style.
renderOneLine :: Doc -> String Source
Like render, but renders the doc on one line.