File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -423,13 +423,13 @@ delete ary idx = runST (deleteM ary idx)
423423--  |  /O(n)/ Delete an element at the given position in this array, 
424424--  decreasing its size by one. 
425425deleteM  ::  Array  e  ->  Int   ->  ST  s  (Array  e )
426- deleteM ary  idx =  do 
426+ deleteM ary0  idx =  do 
427427    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 
428+         do  mary0  <-  unsafeThaw ary0 
429+            mary1  <-  cloneM mary0  0  (count - 1 ) 
430+            copy ary0  (idx+ 1 ) mary1  idx (count- (idx+ 1 ))
431+            unsafeFreeze mary1 
432+   where  ! count =  length  ary0 
433433{-# INLINE  deleteM #-}
434434
435435map  ::  (a  ->  b ) ->  Array  a  ->  Array  b 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments