We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7d4ca70 commit 71bfd61Copy full SHA for 71bfd61
Data/HashMap/Internal/Array.hs
@@ -423,13 +423,13 @@ delete ary idx = runST (deleteM ary idx)
423
-- | /O(n)/ Delete an element at the given position in this array,
424
-- decreasing its size by one.
425
deleteM :: Array e -> Int -> ST s (Array e)
426
-deleteM ary idx = do
+deleteM ary0 idx = do
427
CHECK_BOUNDS("deleteM", count, idx)
428
- do mary <- new_ (count-1)
429
- copy ary 0 mary 0 idx
430
- copy ary (idx+1) mary idx (count-(idx+1))
431
- unsafeFreeze mary
432
- where !count = length ary
+ do mary0 <- unsafeThaw ary0
+ mary1 <- cloneM mary0 0 (count-1)
+ copy ary0 (idx+1) mary1 idx (count-(idx+1))
+ unsafeFreeze mary1
+ where !count = length ary0
433
{-# INLINE deleteM #-}
434
435
map :: (a -> b) -> Array a -> Array b
0 commit comments