wl-pprint-console-0.1.0.2: Wadler/Leijen pretty printer supporting colorful console output.

CopyrightDaniel Mendler (c) 2017
LicenseMIT (see the file LICENSE)
Maintainermail@daniel-mendler.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

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

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

displayColored :: (String -> o) -> (a -> [Colored o]) -> SimpleDoc a -> [Colored o] Source #

Display a rendered document with ANSI escape sequences and output a Colored array.

The annotations are mapped to a Colored array.

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.

putDocColored :: Term -> (a -> [Colored String]) -> Doc a -> IO () Source #

The action (putDocColored f doc) pretty prints doc to stdout 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.