<a href="http://hackage.haskell.org/trac/ghc/ticket/4278">http://hackage.haskell.org/trac/ghc/ticket/4278</a><div><br></div><div>Proposal: Add strict versions of foldlWithKey and insertLookupWithKey to Data.Map</div><div><br>

</div>This proposal depends on #4277 [1].<br><br>The current Data.Map API lacks two important functions:<br><br>    * A strict left (pre-order) fold -- needed to e.g. sum all the values in a map efficiently.<br><br>    * A strict insertLookupWithKey&#39; -- needed to e.g. update an integer counter and retrieve the previous value in a single traversal.<br>

<br>The benchmark we ran indicates that foldlWithKey&#39; is 95% faster than its lazy counter part.insertLookupWithKey&#39; is only 6% faster, but the speedup is highly dependent on how many times each element is update. Each element was only updated once in our benchmark so real speedups should be larger.<br>

<br>The consideration period is 3 weeks.<br><br><div>1. <a href="http://hackage.haskell.org/trac/ghc/ticket/4277">http://hackage.haskell.org/trac/ghc/ticket/4277</a></div><div><br></div>