prettyprinter-convert-ansi-wl-pprint-1.1.1: Converter from »ansi-wl-pprint« documents to »prettyprinter«-based ones.

Safe HaskellSafe
LanguageHaskell2010

Prettyprinter.Convert.AnsiWlPprint

Description

Convert back and forth between the Doc type of the ansi-wl-pprint and the Doc of the prettyprinter package. Useful in order to use the prettyprinter library together with another library that produces ansi-wl-pprint output, and vice versa.

╭────────────────────╮    fromAnsiWlPprint    ╭────────────────────╮
│        Doc         ├───────────────────────▷│  Doc AnsiStyle     │
│  (ansi-wl-pprint)  │◁───────────────────────┤  (prettyprinter)   │
╰────────────────────╯     toAnsiWlPprint     ╰────────────────────╯

These conversion functions work well, but strictly speaking they are not inverses of each other. ansi-wl-pprint supports slightly less features than prettyprinter – the latter has italics, and allows reacting on the configured ribbon width via withPageWidth.

Synopsis

Documentation

fromAnsiWlPprint :: Doc -> Doc AnsiStyle Source #

ansi-wl-pprint ───▷ prettyprinter

toAnsiWlPprint :: Doc AnsiStyle -> Doc Source #

prettyprinter ───▷ ansi-wl-pprint