Re: new keyword: infixlr?

2010-09-19 Thread Freddie Manners
My prosaic solution would be to have more stock implementations of mconcat (here balancedMconcat, though some parallelMconcat's would also be fun) that make use of the associativity guarantee. Then use that explicitly:-- balancedMconcat . fmap Sum $ [a, b, c, 2, 3, d] rather than asking the comp

Re: new keyword: infixlr?

2010-09-14 Thread Bas van Dijk
Oops, I mixed up associative with commutative. On Tue, Sep 14, 2010 at 1:27 PM, Bas van Dijk wrote: > On Mon, Sep 13, 2010 at 4:23 PM, Nick Bowler wrote: >> ... not all Num instances have an associative (+). > > Indeed: > > $ cabal install repr    # [1] > ... > $ ghci > Prelude> :m Text.Repr > P

Re: new keyword: infixlr?

2010-09-14 Thread Bas van Dijk
On Mon, Sep 13, 2010 at 4:23 PM, Nick Bowler wrote: > ... not all Num instances have an associative (+). Indeed: $ cabal install repr# [1] ... $ ghci Prelude> :m Text.Repr Prelude Text.Repr> show (1 + 2 :: Repr Int) == show (2 + 1 :: Repr Int) False because: show (1 + 2 :: Repr Int) == "1 +

Re: new keyword: infixlr?

2010-09-13 Thread Esa Pulkkinen
In message , "S. Doaitse Swierstra" writes: >Currently Haskell has infix, infixl and infixr operators. I see a use for infi >xlr as well. This indicates that the implemtation may assume the operator to b >e associative, and thus has the freedom to "balance" an expression containing >several opera

Re: new keyword: infixlr?

2010-09-13 Thread Nick Bowler
On 2010-09-10 19:13 +0100, Ian Lynagh wrote: > When first reading the proposal, I thought the idea was to allow the > compiler to more easily perform optimisations like > a+b+c+2+3+d => a+b+c+5+d Of course, since I don't think fixity can be specified per-instance of Num, one would not be able

Re: new keyword: infixlr?

2010-09-12 Thread Lennart Augustsson
I don't think a syntactic property (how operators are parsed) should be mixed up with a semantic property (being associative). At least not in Haskell. On Fri, Sep 10, 2010 at 7:51 PM, S. Doaitse Swierstra wrote: > > Currently Haskell has infix, infixl and infixr operators. I see a use for > inf

Re: new keyword: infixlr?

2010-09-12 Thread Ian Lynagh
On Fri, Sep 10, 2010 at 11:14:53PM +0200, S. Doaitse Swierstra wrote: > > On 10 sep 2010, at 20:13, Ian Lynagh wrote: > > > On Fri, Sep 10, 2010 at 07:51:10PM +0200, S. Doaitse Swierstra wrote: > >> > >> Currently Haskell has infix, infixl and infixr operators. I see a use for > >> infixlr as w

Re: new keyword: infixlr?

2010-09-10 Thread Wolfgang Jeltsch
Am Freitag, den 10.09.2010, 23:18 +0200 schrieb S. Doaitse Swierstra: > On 10 sep 2010, at 20:13, Ian Lynagh wrote: > > How would the compiler work out which parsing to prefer? Or would it > > assume that infixlr expressions are best balanced? > > Yes, that is the idea. To me, it seems weird that

Re: new keyword: infixlr?

2010-09-10 Thread S. Doaitse Swierstra
On 10 sep 2010, at 20:13, Ian Lynagh wrote: > On Fri, Sep 10, 2010 at 07:51:10PM +0200, S. Doaitse Swierstra wrote: >> >> Currently Haskell has infix, infixl and infixr operators. I see a use for >> infixlr as well. This indicates that the implemtation may assume the >> operator to be associat

Re: new keyword: infixlr?

2010-09-10 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 9/10/10 14:13 , Ian Lynagh wrote: > When first reading the proposal, I thought the idea was to allow the > compiler to more easily perform optimisations like > a+b+c+2+3+d => a+b+c+5+d > but I guess that wasn't something you were thinking about?

Re: new keyword: infixlr?

2010-09-10 Thread Ian Lynagh
On Fri, Sep 10, 2010 at 07:51:10PM +0200, S. Doaitse Swierstra wrote: > > Currently Haskell has infix, infixl and infixr operators. I see a use for > infixlr as well. This indicates that the implemtation may assume the operator > to be associative, and thus has the freedom to "balance" an expres

new keyword: infixlr?

2010-09-10 Thread S. Doaitse Swierstra
Currently Haskell has infix, infixl and infixr operators. I see a use for infixlr as well. This indicates that the implemtation may assume the operator to be associative, and thus has the freedom to "balance" an expression containing several operator occurrences. The reason that I bring up thi