h1. ANSI Wadler/Leijen Pretty Printer You can help improve this README with extra snippets and advice by using the "GitHub wiki":http://github.com/batterseapower/ansi-wl-pprint/wikis/readme. h2. Installing To just install the library:
runghc Setup.lhs configure
runghc Setup.lhs build
sudo runghc Setup.lhs install
If you want to build the example, to check it's all working:
runghc Setup.lhs configure -fexample
runghc Setup.lhs build
dist/build/ansi-wl-pprint-example/ansi-wl-pprint-example
h2. Description A pretty printing library based on Wadler's paper "A Prettier Printer". It has been enhanced with support for ANSI terminal colored output using the "ansi-terminal":http://github.com/batterseapower/ansi-terminal package. This package is extensively based on Daan Leijen's excellent "wl-pprint":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/wl-pprint library. h2. Example A full example is provided with the package, and can be compiled by suppling Cabal with the @-fexample@ flag. It is also available online at "GitHub":http://github.com/batterseapower/ansi-wl-pprint/tree/master/Text/PrettyPrint/ANSI/Example.hs. h2. Manual The library provides the obvious API, which just allows colorization of any @Doc@ value. It looks something like this:
-- | Displays a document with the given forecolor
black, red, green, yellow, blue, magenta, cyan, white :: Doc -> Doc
 
-- | Displays a document with a forecolor given in the first parameter
color :: ANSIColor -> Doc -> Doc
 
-- | Displays a document with the given backcolor
blackb, redb, greenb, yellowb, blueb, magentab, cyanb, whiteb :: Doc -> Doc
 
-- | Displays a document with a backcolor given in the first parameter
colorb :: ANSIColor -> Doc -> Doc
Due to a technical limitation with ANSI colors on Windows, no colors will be displayed on that platform if you output via a @String@. However, @putDoc@ and @hPutDoc@ should work just fine on Windows. h2. Linkage * "Hackage":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ansi-wl-pprint/ * "Bug Tracker":http://bsp.lighthouseapp.com/projects/16293-hs-ansi-wl-pprint/ * "GitHub":http://github.com/batterseapower/ansi-wl-pprint/