File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -2101,9 +2101,9 @@ filterMapAux onLeaf onColl = go
21012101 ch <- A. read mary 0
21022102 case ch of
21032103 t | isLeafOrCollision t -> return t
2104- _ -> BitmapIndexed b <$> A. trim mary 1
2104+ _ -> BitmapIndexed b <$> ( A. unsafeFreeze =<< A. shrink mary 1 )
21052105 _ -> do
2106- ary2 <- A. trim mary j
2106+ ary2 <- A. unsafeFreeze =<< A. shrink mary j
21072107 return $! if j == maxChildren
21082108 then Full ary2
21092109 else BitmapIndexed b ary2
@@ -2130,7 +2130,7 @@ filterMapAux onLeaf onColl = go
21302130 return $! Leaf h l
21312131 _ | i == j -> do ary2 <- A. unsafeFreeze mary
21322132 return $! Collision h ary2
2133- | otherwise -> do ary2 <- A. trim mary j
2133+ | otherwise -> do ary2 <- A. unsafeFreeze =<< A. shrink mary j
21342134 return $! Collision h ary2
21352135 | Just el <- onColl $! A. index ary i
21362136 = A. write mary j el >> step ary mary (i+ 1 ) (j+ 1 ) n
Original file line number Diff line number Diff line change @@ -52,14 +52,14 @@ module Data.HashMap.Internal.Array
5252 , insertM
5353 , delete
5454 , sameArray1
55- , trim
5655
5756 , unsafeFreeze
5857 , unsafeThaw
5958 , unsafeSameArray
6059 , run
6160 , copy
6261 , copyM
62+ , cloneM
6363
6464 -- * Folds
6565 , foldl
@@ -318,11 +318,6 @@ cloneM _mary@(MArray mary#) _off@(I# off#) _len@(I# len#) =
318318 case cloneSmallMutableArray# mary# off# len# s of
319319 (# s', mary'# # ) -> (# s', MArray mary'# # )
320320
321- -- | Create a new array of the @n@ first elements of @mary@.
322- trim :: MArray s a -> Int -> ST s (Array a )
323- trim mary n = cloneM mary 0 n >>= unsafeFreeze
324- {-# INLINE trim #-}
325-
326321-- | \(O(n)\) Insert an element at the given position in this array,
327322-- increasing its size by one.
328323insert :: Array e -> Int -> e -> Array e
You can’t perform that action at this time.
0 commit comments