Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For anyone curious about the difference between the two: Hughes' pretty printer works really well for pretty-printing Haskell code, but Wadler's is more flexible for pretty-printing C-style languages where there is a dedented closing brace at the end of scopes.

It is 100% true that Hughes' paper is a better introduction to the idea of having algebraic document combinators. One can skim Hughes' and then feel at ease using a library that implements Wadler's printer - the bigger differences between the two libraries are tucked away in the layout algorithms and the APIs are similar.



> Hughes' pretty printer works really well for pretty-printing Haskell code, but Wadler's is more flexible for pretty-printing C-style languages where there is a dedented closing brace at the end of scopes.

That's very interesting! So far I've only used Wadler-Leijen-style prettyprinters.

Are Hughes-style pretty printers "better" in some way for Haskell-like documents? If so, why?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: