
18 Aug
2010
18 Aug
'10
8:47 a.m.
On Wed, Aug 18, 2010 at 12:01:54PM +0200, Johan Tibell wrote:
foldlWithKey' :: (b -> k -> a -> b) -> b -> Map k a -> b foldlWithKey' f z0 m = go z0 m where go z Tip = z go z (Bin _ kx x l r) = let x' = f (go z l) kx x in x' `seq` go x' r
Could someone please explain the difference. I would like to be able to to understand when I would get the former or the latter by looking at the Haskell source.
If f is not strict in its first argument (e.g. if it always ignore it) then go is not strict in z. Thanks Ian