ekmett/wl-pprint-extras — pull request #4 by sjindel (2013-08-16 00:31:52+00:00)
Title: Several improvements to the Wadler-Leijen pretty-printing algorithm.

1) Addition of the @Fail@ primitive, representing a document that can not be
rendered. @Fail@ is a left unit of @Union@ and does not `fit' into any page
width. It allows the construction of documents that can not be flattened, for
example comments that must be followed by a newline. It also alows the
construction of hard lines, which are guaranteed to be rendered as a newline.

2) Addition of the @FlatAlt@ primitive, representing a document which changes
under flattening. This unifies the linebreak combinators and allows for more
flexible linebreak to be created, for example linebreaks in a do-block that
should become semicolons when flattened.

3) Addition of a more intelligent rendering algorithm, which partially solves
the lookahead problem caused by deeply nested structures where a single-line
lookahead will not always allow a document to be formatted within the
pagewidth.