Skip to content

Commit f4bf21d

Browse files
authored
Consistently use lookupResToMaybe (#460)
1 parent 455ad49 commit f4bf21d

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Data/HashMap/Internal.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,9 +1426,7 @@ alterFEager f !k m = (<$> f mv) $ \case
14261426

14271427
where !h = hash k
14281428
!lookupRes = lookupRecordCollision h k m
1429-
!mv = case lookupRes of
1430-
Absent -> Nothing
1431-
Present v _ -> Just v
1429+
!mv = lookupResToMaybe lookupRes
14321430
{-# INLINABLE alterFEager #-}
14331431

14341432
-- | \(O(n \log m)\) Inclusion of maps. A map is included in another map if the keys

Data/HashMap/Internal/Strict.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ alterFEager f !k !m = (<$> f mv) $ \fres ->
438438

439439
where !h = hash k
440440
!lookupRes = HM.lookupRecordCollision h k m
441-
!mv = case lookupRes of
442-
Absent -> Nothing
443-
Present v _ -> Just v
441+
!mv = HM.lookupResToMaybe lookupRes
444442
{-# INLINABLE alterFEager #-}
445443

446444
------------------------------------------------------------------------

0 commit comments

Comments
 (0)