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

2008-01-23 Thread devriese
Nice! I'll give that a try, Thanks, Edsko ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2008-01-22 Thread Allan Clark
Edsko de Vries wrote: Hi, 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 :) Any hints or pointers would be appreciated,

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

2008-01-22 Thread Ryan Ingram
On 1/22/08, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > Take a look at how Haskell's derived Show instances do it? :-) > > http://www.haskell.org/onlinereport/derived.html#sect10.4 I hate how Haskell handles precedence: 1) Arbitrary magic numbers for precedence, which isn't very natural. 2) Imp

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

2008-01-22 Thread Benja Fallenstein
Hi Edsko, On Jan 22, 2008 7:34 PM, Edsko de Vries <[EMAIL PROTECTED]> 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 >

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

2008-01-22 Thread Edsko de Vries
Hi, Suppose we have some algebraic datatype describing an expression language containing the usual suspects (various binary arithmetic operators such as addition, subtraction, multiplication, division, exponentiation, function abstraction and application, etc.) each with their own precendence (mul