| Copyright | Daniel Mendler (c) 2017 |
|---|---|
| License | MIT (see the file LICENSE) |
| Maintainer | mail@daniel-mendler.de |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Text.PrettyPrint.Console.WL
Contents
Description
This is a pretty printer with support for annotations. The annotations can be mapped to ANSI escape sequences to allow for colorful output on consoles. For this purpose the console-style library is used.
Synopsis
- module Text.PrettyPrint.Annotated.WL
- displayWrapped :: Monoid o => (String -> o) -> SimpleDoc (String, String) -> o
- displayWrappedT :: SimpleDoc (String, String) -> Text
- displayWrappedB :: SimpleDoc (String, String) -> ByteString
- displayWrappedS :: SimpleDoc (String, String) -> ShowS
- displayHTML :: Monoid o => (String -> o) -> (a -> String) -> SimpleDoc a -> o
- displayHTMLT :: (a -> String) -> SimpleDoc a -> Text
- displayHTMLB :: (a -> String) -> SimpleDoc a -> ByteString
- displayHTMLS :: (a -> String) -> SimpleDoc a -> ShowS
- displayColoredT :: (a -> [Colored Builder]) -> Term -> SimpleDoc a -> Text
- displayColoredB :: (a -> [Colored Builder]) -> Term -> SimpleDoc a -> ByteString
- displayColoredS :: (a -> [Colored String]) -> Term -> SimpleDoc a -> ShowS
- displayColored :: (String -> o) -> (a -> [Colored o]) -> SimpleDoc a -> [Colored o]
- hPutDocColored :: Handle -> Term -> (a -> [Colored String]) -> Doc a -> IO ()
- putDocColored :: Term -> (a -> [Colored String]) -> Doc a -> IO ()
- displayB :: SimpleDoc a -> ByteString
Reexport of Text.PrettyPrint.Annotated.WL
Display documents annotated with pairs of strings
displayWrapped :: Monoid o => (String -> o) -> SimpleDoc (String, String) -> o Source #
Display a rendered document which is annotated with pairs of strings (String,String) and
output a Monoid.
The first element of the pair is prepended to the annotated region, the second after the annotated region.
displayWrappedT :: SimpleDoc (String, String) -> Text Source #
Display a rendered document which is annotated with pairs of strings (String,String) and
output Text.
The first element of the pair is prepended to the annotated region, the second after the annotated region.
displayWrappedB :: SimpleDoc (String, String) -> ByteString Source #
Display a rendered document which is annotated with pairs of strings (String,String) and
output ByteString.
The first element of the pair is prepended to the annotated region, the second after the annotated region.
displayWrappedS :: SimpleDoc (String, String) -> ShowS Source #
Display a rendered document which is annotated with pairs of strings (String,String) and
output a ShowS function.
The first element of the pair is prepended to the annotated region, the second after the annotated region.
Display as HTML
displayHTML :: Monoid o => (String -> o) -> (a -> String) -> SimpleDoc a -> o Source #
Display a rendered document as HTML and output a Monoid.
The annotated region is wrapped by class="f a"../span with the class attribute
given by the annotation function.
displayHTMLT :: (a -> String) -> SimpleDoc a -> Text Source #
Display a rendered document as HTML and output Text.
The annotated region is wrapped by class="f a"../span with the class attribute
given by the annotation function.
displayHTMLB :: (a -> String) -> SimpleDoc a -> ByteString Source #
Display a rendered document as HTML and output ByteString.
The annotated region is wrapped by class="f a"../span with the class attribute
given by the annotation function.
displayHTMLS :: (a -> String) -> SimpleDoc a -> ShowS Source #
Display a rendered document as HTML and output a ShowS function.
The annotated region is wrapped by class="f a"../span with the class attribute
given by the annotation function.
Display with ANSI escape sequences
displayColoredT :: (a -> [Colored Builder]) -> Term -> SimpleDoc a -> Text Source #
Display a rendered document with ANSI escape sequences and output Text.
The annotations are mapped to a '[Colored TL.Builder]' array.
displayColoredB :: (a -> [Colored Builder]) -> Term -> SimpleDoc a -> ByteString Source #
Display a rendered document with ANSI escape sequences and output ByteString.
The annotations are mapped to a '[Colored BL.Builder]' array.
displayColoredS :: (a -> [Colored String]) -> Term -> SimpleDoc a -> ShowS Source #
Display a rendered document with ANSI escape sequences and output a ShowS function.
The annotations are mapped to a '[Colored a]' array.
Display to a file handle with ANSI escape sequences
hPutDocColored :: Handle -> Term -> (a -> [Colored String]) -> Doc a -> IO () Source #
The action (hPutDocColored handle f doc) pretty prints doc to file handle handle
using the annotations.
The annotations are mapped by f to Colored arrays.
Display without annotations (Missing from wl-pprint-annotated)
displayB :: SimpleDoc a -> ByteString Source #
(display simpleDoc) takes the output simpleDoc from a
rendering function and outputs a ByteString. Along the way, all annotations are
discarded.