A port of the Haskell prettyprinter
library by Wadler and friends. They did a phenomenal job of documenting the API so I suggest using their docs as your primary reference.
- Rather than having annotation nodes and string nodes, I chose to have only
Renderable
nodes. Something is renderable if it defines anewline
value, aspace
value, and a function for computingwidth
(e.g.String.length
). I think this is simpler, but you might disagree. It may also be less efficient. If you have thoughts on this let me know.
paf31/purescript-pprint
: Written by the boss man himself, this package defines some clean and simple document primitives but doesn't handle alternative layouts. Use this if your layout logic is fairly simple.paulyoung/purescript-prettier-printer
: A faithful implementation of Wadler's original paper, but lacking some of the powerful extensions added by theprettyprinter
package. If you don't need the extra functionality then this might be a better choice.
- Port more functionality (if necessary)
- Implement ribbon widths
- More tests
- Optimisations
- Stack safety