|
|
|
|
| Synopsis |
|
|
|
| Documentation |
|
| data Printable |
| A Printable is either a String, a packed string, or a chunk of
text with both representations.
| | Constructors | | S !String | | | PS !ByteString | | | Both !String !ByteString | |
|
|
|
| space_p :: Printable |
| space_p is the Printable representation of a space.
|
|
| newline_p :: Printable |
| newline_p is the Printable representation of a newline.
|
|
| newline :: Doc |
| Minimal Docs representing the common characters space, newline
minus, plus, and backslash.
|
|
| plus :: Doc |
|
| minus :: Doc |
|
| backslash :: Doc |
|
| space :: Doc |
|
| lparen :: Doc |
| lparen is the Doc that represents "("
|
|
| rparen :: Doc |
| rparen is the Doc that represents ")"
|
|
| parens :: Doc -> Doc |
| parens doc returns a Doc with the content of doc put within
a pair of parenthesis.
|
|
| errorDoc :: Doc -> a |
|
| putDocWith :: Printers -> Doc -> IO () |
| putDocWith puts a doc on stdout using the given printer.
|
|
| putDocLnWith :: Printers -> Doc -> IO () |
| putDocLnWith puts a doc, followed by a newline on stdout using
the given printer.
|
|
| putDoc :: Doc -> IO () |
| putDoc puts a doc on stdout using the simple printer simplePrinters.
|
|
| putDocLn :: Doc -> IO () |
| putDocLn puts a doc, followed by a newline on stdout using
simplePrinters
|
|
| hPutDocWith :: Printers -> Handle -> Doc -> IO () |
| hputDocWith puts a doc on the given handle using the given printer.
|
|
| hPutDocLnWith :: Printers -> Handle -> Doc -> IO () |
| hputDocLnWith puts a doc, followed by a newline on the given
handle using the given printer.
|
|
| hPutDoc :: Handle -> Doc -> IO () |
| hputDoc puts a doc on the given handle using simplePrinters
|
|
| hPutDocLn :: Handle -> Doc -> IO () |
|
| hPrintPrintables :: Handle -> [Printable] -> IO () |
| hPrintPrintables h prints a list of Printables to the handle h
|
|
| hPrintPrintable :: Handle -> Printable -> IO () |
| hPrintPrintable h prints a Printable to the handle h.
|
|
| newtype Doc |
| a Doc is a bit of enriched text. Docs get concatanated using
<>, which is right-associative.
| | Constructors | | Instances | |
|
|
| data St |
| The State associated with a doc. Contains a set of printers for each
hanlde, and the current prefix of the document.
| | Constructors | |
|
|
| type Printers = Handle -> Printers' |
|
| data Printers' |
| A set of printers to print different types of text to a handle.
| | Constructors | |
|
|
| type Printer = Printable -> St -> Document |
|
| data Color |
|
|
| data Document |
| Document is a wrapper around '[Printable] -> [Printable]' which allows
for empty Documents. The simplest Documents are built from Strings
using text.
| | Constructors | |
|
|
| renderString :: Doc -> String |
| renders a Doc into a String with control codes for the
special features of the doc.
|
|
| renderStringWith :: Printers' -> Doc -> String |
| renders a Doc into a String using a given set of printers.
|
|
| renderPS :: Doc -> ByteString |
| renders a Doc into ByteString with control codes for the
special features of the Doc. See also readerString.
|
|
| renderPSs :: Doc -> [ByteString] |
| renders a Doc into a list of PackedStrings, one for each line.
|
|
| renderPSWith :: Printers' -> Doc -> ByteString |
| renders a doc into a ByteString using a given set of printers.
|
|
| renderPSsWith :: Printers' -> Doc -> [ByteString] |
| renders a Doc into a list of PackedStrings, one for each
chunk of text that was added to the doc, using the given set of
printers.
|
|
| renderWith :: Printers' -> Doc -> [Printable] |
| renders a Doc into a list of Printables using a set of
printers. Each item of the list corresponds to a string that was
added to the doc.
|
|
| init_state :: Printers' -> St |
|
| prefix :: String -> Doc -> Doc |
|
| insert_before_lastline :: Doc -> Doc -> Doc |
|
| lineColor :: Color -> Doc -> Doc |
|
| hiddenPrefix :: String -> Doc -> Doc |
|
| unsafeBoth :: String -> ByteString -> Doc |
| unsafeBoth builds a Doc from a String and a ByteString representing
the same text, but does not check that they do.
|
|
| unsafeBothText :: String -> Doc |
| unsafeBothText builds a Doc from a String. The string is stored in the
Doc as both a String and a ByteString.
|
|
| packedString :: ByteString -> Doc |
| packedString builds a Doc from a ByteString using printable
|
|
| unsafePackedString :: ByteString -> Doc |
| unsafePackedString builds a Doc from a ByteString using simplePrinter
|
|
| invisiblePS :: ByteString -> Doc |
| invisiblePS creates a Doc with invisible text from a ByteString
|
|
| userchunkPS :: ByteString -> Doc |
| userchunkPS creates a Doc representing a user chunk from a ByteString.
|
|
| unsafeChar :: Char -> Doc |
| unsafeChar creates a Doc containing just one character.
|
|
| text :: String -> Doc |
| text creates a Doc from a String, using printable.
|
|
| unsafeText :: String -> Doc |
| unsafeText creates a Doc from a String, using simplePrinter directly
|
|
| invisibleText :: String -> Doc |
| invisibleText creates a Doc containing invisible text from a String
|
|
| hiddenText :: String -> Doc |
| hiddenText creates a Doc containing hidden text from a String
|
|
| userchunk :: String -> Doc |
| userchunk creates a Doc containing a user chunk from a String
|
|
| redText :: String -> Doc |
| blueText creates a Doc containing blue text from a String
|
|
| greenText :: String -> Doc |
|
| magentaText :: String -> Doc |
|
| cyanText :: String -> Doc |
|
| blueText :: String -> Doc |
|
| colorText :: Color -> String -> Doc |
| colorText creates a Doc containing colored text from a String
|
|
| wrap_text :: Int -> String -> Doc |
| wrap_text n s is a Doc representing s line-wrapped at n characters
|
|
| invisiblePrintable :: Printable -> Doc |
| 'printable x' creates a Doc from any Printable.
|
|
| hiddenPrintable :: Printable -> Doc |
|
| userchunkPrintable :: Printable -> Doc |
|
| printable :: Printable -> Doc |
|
| mkColorPrintable :: Color -> Printable -> Doc |
|
| simplePrinters :: Printers |
| simplePrinters is a Printers which uses the set 'simplePriners\'' on any
handle.
|
|
| simplePrinters' :: Printers' |
| A set of default printers suitable for any handle. Does not use color.
|
|
| simplePrinter :: Printer |
| simplePrinter is the simplest Printer: it just concatenates together
the pieces of the Doc
|
|
| invisiblePrinter :: Printer |
| invisiblePrinter is the Printer for hidden text. It just replaces
the document with empty. It's useful to have a printer that doesn't
actually do anything because this allows you to have tunable policies,
for example, only printing some text if it's to the terminal, but not
if it's to a file or vice-versa.
|
|
| empty :: Doc |
| The empty Doc.
|
|
| doc :: ([Printable] -> [Printable]) -> Doc |
|
| (<>) :: Doc -> Doc -> Doc |
| '()' is the concatenation operator for Docs
|
|
| (<?>) :: Doc -> Doc -> Doc |
| a <?> b is a if it is not empty, else b.
|
|
| (<+>) :: Doc -> Doc -> Doc |
| a <+> b is a followed by a space, then b.
|
|
| ($$) :: Doc -> Doc -> Doc |
| a $$ b is a above b.
|
|
| vcat :: [Doc] -> Doc |
| vcat piles vertically a list of Docs.
|
|
| vsep :: [Doc] -> Doc |
| vsep piles vertically a list of Docs leaving a blank line between each.
|
|
| hcat :: [Doc] -> Doc |
| hcat concatenates (horizontally) a list of Docs
|
|
| Produced by Haddock version 2.4.2 |