Scherrer, Chad wrote:
 
>     f m x = Map.insertWith (+) x 1 m

insertWith is inserting the "nonobvious thunks".  Internally it applies
(+) to the old value and the new one, producing a thunk.  There is no
place you could put a seq or something to force the result.  You
basically need insertWith', which isn't there.

I think, your best best is to manually lookup the old value, combine
with the new, force the result, then insert that, overwriting the old
value.

On top of that you still need foldl' to avoid building long chains of
Map.insert.


Udo.
-- 
The Second Law of Thermodynamics:
        If you think things are in a mess now, just wait!
                        -- Jim Warner

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to