> {-# RULES 
>  
> "foldr/Data.Map.elems" forall f z m . foldr f z (elems m) = foldr f z m; 
> "foldl/Data.Map.elems" forall f z m . foldl f z (elems m) = foldl f z m; 
> "foldr/Data.Map.keys" forall f z m . foldr f z (keys m) = foldrWithKey (\ k _ -> f k) z m; 
> "foldl/Data.Map.keys" forall f z m . foldl f z (keys m) = foldlWithKey (\ z k _ -> f z k) z m; 
> "foldr/Data.Map.toAscList" forall f z m . foldr f z (toAscList m) = foldrWithKey (curry f) z m; 
> "foldl/Data.Map.toAscList" forall f z m . foldl f z (toAscList m) = foldlWithKey (curry . f) z m; #-}
A few thoughts on this issue:
Louis Wasserman
wasserman.louis@gmail.com
http://profiles.google.com/wasserman.louis


Why not implement elems etc. in terms of build? This would make them play nicely with foldr/build fusion at no cost.

Roman