on master help sign in
Rename unsafeCopy to partialCopyM
cf24eadBryan O'Sullivan
Data/Text/Array.hs+5−5
@@ -31,11 +31,11 @@ module Data.Text.Array
31
31
32 -- * Functions
32 -- * Functions
33 , copy
33 , copy
34+ , partialCopyM
34 , empty
35 , empty
35 , run
36 , run
36 , run2
37 , run2
37 , toList
38 , toList
38− , unsafeCopy
39 , unsafeFreeze
39 , unsafeFreeze
40 , unsafeIndex
40 , unsafeIndex
41 , unsafeNew
41 , unsafeNew
@@ -204,9 +204,9 @@ copy dest@(MArray dlen _) src@(MArray slen _)
204 copy_loop (i+1)
204 copy_loop (i+1)
205{-# INLINE copy #-}
205{-# INLINE copy #-}
206
206
207−-- | Unsafely copy the elements of an array.
207+-- | Copy some elements of a mutable array.
208−unsafeCopy :: MArray s -> Int -> MArray s -> Int -> Int -> ST s ()
208+partialCopyM :: MArray s -> Int -> MArray s -> Int -> Int -> ST s ()
209−unsafeCopy dest didx src sidx count =
209+partialCopyM dest didx src sidx count =
210#if defined(ASSERTS)
210#if defined(ASSERTS)
211 assert (sidx + count <= length src) .
211 assert (sidx + count <= length src) .
212 assert (didx + count <= length dest) $
212 assert (didx + count <= length dest) $
@@ -217,4 +217,4 @@ unsafeCopy dest didx src sidx count =
217 | c >= count = return ()
217 | c >= count = return ()
218 | otherwise = do unsafeRead src i >>= unsafeWrite dest j
218 | otherwise = do unsafeRead src i >>= unsafeWrite dest j
219 copy_loop (i+1) (j+1) (c+1)
219 copy_loop (i+1) (j+1) (c+1)
220−{-# INLINE unsafeCopy #-}
220+{-# INLINE partialCopyM #-}
Data/Text/Fusion.hs+1−1
@@ -136,7 +136,7 @@ reverse (Stream next s len0)
136 Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
136 Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
137 let newLen = len `shiftL` 1
137 let newLen = len `shiftL` 1
138 marr' <- A.unsafeNew newLen
138 marr' <- A.unsafeNew newLen
139− A.unsafeCopy marr' (newLen-len) marr 0 len
139+ A.partialCopyM marr' (newLen-len) marr 0 len
140 write s1 (len+i) newLen marr'
140 write s1 (len+i) newLen marr'
141 | otherwise -> write s1 i len marr
141 | otherwise -> write s1 i len marr
142 where n = ord x
142 where n = ord x