
2 Jul
2013
2 Jul
'13
3:57 p.m.
On Tue, 2 Jul 2013, Ryan Newton wrote:
Hi all, Thanks for the responses. I want to go through and make sure I understand these.
-------------------------------------------------------- First, Henning, won't both of these allocate in proportion to the size of the map?
Map.foldrWithKey (\k a -> f k a >>) (return ()) Foldable.sequence_ . Map.mapWithKey f
In particular, will the compiler be able to avoid allocating when building up that large monadic computation in the foldrWithKey?
Since it is a foldr, the first action can be run without knowing the following ones. That is, at no time all actions must be allocated.