"Conal Elliott" <conal@conal.net> writes:
What pretty printers are available for Haskell code (not necessarily complete) that handle automatic insertion of minimally required parentheses? I assumed that Language.Haskell.Pretty did that, but apparently it relies on manual insertion of parentheses in the abstract syntax.
The Hat tracing system has a pretty-printer for Haskell expressions that inserts minimal parentheses. However, the Haskell expressions themselves are not parsed, they are reconstructed from runtime trace data. Because of this, the "abstract syntax tree" has significant differences from a standard internal compiler representation. Nevertheless, you might find the pretty-printing code has some useful algorithm that you can rework for your own purposes. (Note that the PP combinator library is Wadler-style, not HughesPJ-style.) http://haskell.org/hat Regards, Malcolm