batterseapower / ansi-wl-pprint

The Wadler/Leijen Pretty Printer for colored ANSI terminal output
http://batterseapower.github.com/ansi-wl-pprint
Other
30 stars 15 forks source link

Expose Union functionality #4

Open dolio opened 11 years ago

dolio commented 11 years ago

Currently, the only way that Union is exposed is through group. However, group can only fiddle with white space. There are cases where this is not good enough. For instance, pretty printing a Haskell case statement:

case e of C1 x -> e1 ; C2 x y -> e2 ; ...

vs.

case e of
  C1 x -> e1
  C2 x y -> e2
  ...

Line breaks must turn into semicolons when trying to lay out on a single line.

A union combinator might allow people to break the invariant, but I'm not sure how to better handle arbitrary new functionality of this type, and it'd be nice to have.

hvr commented 9 years ago

please migrate to https://github.com/ekmett/ansi-wl-pprint/issues