Proposal: Add a strict version of foldlWithKey to Data.Map

Ian Lynagh igloo at earth.li
Sun Aug 22 08:47:19 EDT 2010


On Sun, Aug 22, 2010 at 09:45:32AM +0200, Johan Tibell wrote:
> On Sat, Aug 21, 2010 at 1:45 PM, Ian Lynagh <igloo at earth.li> wrote:
> 
> > On Wed, Aug 18, 2010 at 02:00:39PM +0200, Johan Tibell wrote:
> > >
> > > The current API doesn't offer any efficient way to do something simple as
> > > e.g. summing the values in a map. I suggest we add a foldlWithKey'
> > function:
> > >
> > >     http://hackage.haskell.org/trac/ghc/ticket/4261
> >
> > Shouldn't (go z l) be forced too?
> 
> It makes sense to me to do so but the core looks worse for some reason:

Well, if there's a GHC code performance bug then we should fix it, but I
don't think we should use a workaround in the libraries that gives a
function the wrong strictness.

> which doesn't have an unboxed accumulator. I'm not sure why.

Can you file a GHC ticket with a standalone testcase please?


Thanks
Ian



More information about the Libraries mailing list