@@ -197,7 +197,15 @@ instance Functor (HashMap k) where
197
197
fmap = map
198
198
199
199
instance Foldable. Foldable (HashMap k ) where
200
- foldr f = foldrWithKey (const f)
200
+ foldr = Data.HashMap.Base. foldr
201
+ {-# INLINE foldr #-}
202
+ foldl' = Data.HashMap.Base. foldl'
203
+ {-# INLINE foldl' #-}
204
+ null = Data.HashMap.Base. null
205
+ {-# INLINE null #-}
206
+ length = Data.HashMap.Base. size
207
+ {-# INLINE length #-}
208
+
201
209
202
210
#if __GLASGOW_HASKELL__ >= 711
203
211
instance (Eq k , Hashable k ) => Semigroup (HashMap k v ) where
@@ -1530,7 +1538,7 @@ intersectionWithKey f a b = foldlWithKey' go empty a
1530
1538
-- | /O(n)/ Reduce this map by applying a binary operator to all
1531
1539
-- elements, using the given starting value (typically the
1532
1540
-- left-identity of the operator). Each application of the operator
1533
- -- is evaluated before using the result in the next application.
1541
+ -- is evaluated before using the result in the next application.
1534
1542
-- This function is strict in the starting value.
1535
1543
foldl' :: (a -> v -> a ) -> a -> HashMap k v -> a
1536
1544
foldl' f = foldlWithKey' (\ z _ v -> f z v)
@@ -1539,7 +1547,7 @@ foldl' f = foldlWithKey' (\ z _ v -> f z v)
1539
1547
-- | /O(n)/ Reduce this map by applying a binary operator to all
1540
1548
-- elements, using the given starting value (typically the
1541
1549
-- left-identity of the operator). Each application of the operator
1542
- -- is evaluated before using the result in the next application.
1550
+ -- is evaluated before using the result in the next application.
1543
1551
-- This function is strict in the starting value.
1544
1552
foldlWithKey' :: (a -> k -> v -> a ) -> a -> HashMap k v -> a
1545
1553
foldlWithKey' f = go
0 commit comments