Commits

Belind committed 5ac64f1

Rewrite elems in terms of foldr.

Comments (0)

Files changed (1)

Data/CritBit/Tree.hs

 -- > elems (fromList [("b",5), ("a",3)]) == [3,5]
 -- > elems empty == []
 elems :: CritBit k v -> [v]
-elems m = foldrWithKey f [] m
-  where f _ v vs = v : vs
+elems m = foldr (:) [] m
+{-# INLINE elems #-}
 
 -- | /O(n)/. An alias for 'toAscList'. Return all key/value pairs in the map in
 -- ascending order.