[Haskell-cafe] Precedence and associativity in a pretty-printer

Benja Fallenstein benja.fallenstein at gmail.com
Tue Jan 22 13:42:45 EST 2008


Hi Edsko,

On Jan 22, 2008 7:34 PM, Edsko de Vries <devriese at cs.tcd.ie> wrote:
> Is there a nice way to pretty-print such an expression with the minimal
> number of brackets? I can come up with something, but I'm sure somebody
> thought hard about this problem before and came up with a really nice
> solution :)

Take a look at how Haskell's derived Show instances do it? :-)

http://www.haskell.org/onlinereport/derived.html#sect10.4

- Benja


More information about the Haskell-Cafe mailing list