-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Labels
Description
unordered-containers/Data/HashMap/Internal/Strict.hs
Lines 544 to 559 in 7237826
| -- | /O(n)/ Transform this map by applying a function to every value | |
| -- and retaining only some of them. | |
| mapMaybeWithKey :: (k -> v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2 | |
| mapMaybeWithKey f = filterMapAux onLeaf onColl | |
| where onLeaf (Leaf h (L k v)) | Just v' <- f k v = Just (leaf h k v') | |
| onLeaf _ = Nothing | |
| onColl (L k v) | Just v' <- f k v = Just (L k v') | |
| | otherwise = Nothing | |
| {-# INLINE mapMaybeWithKey #-} | |
| -- | /O(n)/ Transform this map by applying a function to every value | |
| -- and retaining only some of them. | |
| mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2 | |
| mapMaybe f = mapMaybeWithKey (const f) | |
| {-# INLINE mapMaybe #-} |
I think there's a problem in line 551: v' isn't forced.