/purescript-prettyprinter

✨ Pretty printer library for PureScript

Primary LanguagePureScriptMIT LicenseMIT

purescript-prettyprinter

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.

Comparison to the Haskell package

  • Rather than having annotation nodes and string nodes, I chose to have only Renderable nodes. Something is renderable if it defines a newline value, a space value, and a function for computing width (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.

Comparison to other Purescript packages

TODO

  • Port more functionality (if necessary)
  • Implement ribbon widths
  • More tests
  • Optimisations
  • Stack safety