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