Commits

Bryan O'Sullivan committed 4c90c29

Rename unsafeCopy to partialCopyM

Comments (0)

Files changed (2)

Data/Text/Array.hs

 
     -- * Functions
     , copy
+    , partialCopyM
     , empty
     , run
     , run2
     , toList
-    , unsafeCopy
     , unsafeFreeze
     , unsafeIndex
     , unsafeNew
                            copy_loop (i+1)
 {-# INLINE copy #-}
 
--- | Unsafely copy the elements of an array.
-unsafeCopy :: MArray s -> Int -> MArray s -> Int -> Int -> ST s ()
-unsafeCopy dest didx src sidx count =
+-- | Copy some elements of a mutable array.
+partialCopyM :: MArray s -> Int -> MArray s -> Int -> Int -> ST s ()
+partialCopyM dest didx src sidx count =
 #if defined(ASSERTS)
     assert (sidx + count <= length src) .
     assert (didx + count <= length dest) $
           | c >= count  = return ()
           | otherwise = do unsafeRead src i >>= unsafeWrite dest j
                            copy_loop (i+1) (j+1) (c+1)
-{-# INLINE unsafeCopy #-}
+{-# INLINE partialCopyM #-}

Data/Text/Fusion.hs

           Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
                        let newLen = len `shiftL` 1
                        marr' <- A.unsafeNew newLen
-                       A.unsafeCopy marr' (newLen-len) marr 0 len
+                       A.partialCopyM marr' (newLen-len) marr 0 len
                        write s1 (len+i) newLen marr'
                      | otherwise -> write s1 i len marr
             where n = ord x