We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 102d35b commit 68a2945Copy full SHA for 68a2945
Data/HashMap/Internal/Strict.hs
@@ -742,13 +742,8 @@ updateOrSnocWithKey :: Eq k => (k -> v -> v -> v) -> k -> v -> A.Array (Leaf k v
742
updateOrSnocWithKey f k0 v0 ary0 = go k0 v0 ary0 0 (A.length ary0)
743
where
744
go !k v !ary !i !n
745
- | i >= n = A.run $ do
746
- -- Not found, append to the end.
747
- mary <- A.new_ (n + 1)
748
- A.copy ary 0 mary 0 n
749
- let !l = v `seq` L k v
750
- A.write mary n l
751
- return mary
+ -- Not found, append to the end.
+ | i >= n = A.snoc ary $! L k $! v
752
| otherwise = case A.index ary i of
753
(L kx y) | k == kx -> let !v' = f k v y in A.update ary i (L k v')
754
| otherwise -> go k v ary (i+1) n
0 commit comments