pretty 0.5.2

Wadler-style pretty-printing combinators in Rust

Build Status Docs

Pretty printing combinators for Rust


This crate provides functionality for defining pretty printers. It is particularly useful for printing structured recursive data like trees.

The implementation was originally based on Larsen's SML translation ( of Wadler's Haskell pretty printer ( It has since been modified in various ways to better fit Rust's programming model. In particular, it uses iteration rather than recursion and provides streaming output.


See the generated API documentation here.


  1. Rust
  2. Cargo

You can install both with the following:

$ curl -s | sudo sh

See Installing Rust for further details.


$ cargo build                                          ## build library and binary
$ cargo run --example trees                            ## run the example (pretty trees)
$ cargo run --example colored --features termcolor     ## run the example (pretty colored output)
$ cargo bench                                          ## run benchmarks
$ cargo test                                           ## run tests