new keyword: infixlr?

Freddie Manners f.manners at gmail.com
Sun Sep 19 03:59:06 EDT 2010


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 compiler to be magic for you.

Freddie

On 14 September 2010 13:11, Bas van Dijk <v.dijk.bas at gmail.com> wrote:

> Oops, I mixed up associative with commutative.
>
> On Tue, Sep 14, 2010 at 1:27 PM, Bas van Dijk <v.dijk.bas at gmail.com>
> wrote:
> > On Mon, Sep 13, 2010 at 4:23 PM, Nick Bowler <nbowler at elliptictech.com>
> 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 + 2"
> > show (2 + 1 :: Repr Int) == "2 + 1"
> >
> > but note:
> > Prelude Text.Repr> (1 + 2 :: Repr Int) == (2 + 1 :: Repr Int)
> > True
> >
> > Bas
> >
> > [1] http://hackage.haskell.org/package/repr
> >
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-prime/attachments/20100919/1f3df48d/attachment.html


More information about the Haskell-prime mailing list