@@ -512,8 +512,8 @@ data LookupRes a = Absent | Present a !Int
512
512
--
513
513
-- Outcomes:
514
514
-- Key not in map => Absent
515
- -- Key in map, no collision => Alone v
516
- -- Key in map, collision => Collide v position
515
+ -- Key in map, no collision => Present v (-1)
516
+ -- Key in map, collision => Present v position
517
517
lookupRecordCollision :: Eq k => Hash -> k -> HashMap k v -> LookupRes v
518
518
#if __GLASGOW_HASKELL__ >= 802
519
519
lookupRecordCollision h k m = case lookupRecordCollision# h k m of
@@ -529,9 +529,11 @@ lookupRecordCollision h k m = case lookupRecordCollision# h k m of
529
529
lookupRecordCollision# :: Eq k => Hash -> k -> HashMap k v -> (# (# # ) | (# v , Int # # ) # )
530
530
lookupRecordCollision# h k m =
531
531
lookupCont (\ _ -> (# (# # ) | # )) (\ v (I # i) -> (# | (# v, i # ) # )) h k m
532
+ -- INLINABLE to specialize to the Eq instance.
532
533
{-# INLINABLE lookupRecordCollision# #-}
533
- #else
534
- -- Pre-8.2, no unboxed sums.
534
+
535
+ #else /* GHC < 8.2 so there are no unboxed sums */
536
+
535
537
lookupRecordCollision h k m = lookupCont (\ _ -> Absent ) Present h k m
536
538
{-# INLINABLE lookupRecordCollision #-}
537
539
#endif
@@ -972,8 +974,7 @@ delete' h0 k0 m0 = go h0 k0 0 m0
972
974
| otherwise = t
973
975
{-# INLINABLE delete' #-}
974
976
975
- -- Delete optimized for the case when we know the key is in the map and there is
976
- -- no collision.
977
+ -- | Delete optimized for the case when we know the key is in the map.
977
978
--
978
979
-- It is only valid to call this when the key exists in the map and you know the
979
980
-- hash collision position if there was one. This information can be obtained
0 commit comments