@@ -122,7 +122,7 @@ copyLimit = 128
122122fromText :: S.Text -> Builder
123123fromText t@(Text arr off l)
124124 | S.null t = empty
125− | l <= copyLimit = writeN l $ \marr o -> unsafeCopy arr off marr o l
125+ | l <= copyLimit = writeN l $ \marr o -> A.partialCopyI marr o arr off l
126126 | otherwise = flush `append` mapBuilder (t :)
127127{-# INLINE [1] fromText #-}
128128
@@ -258,21 +258,6 @@ newBuffer size = do
258258 return $! Buffer arr 0 0 size
259259{-# INLINE newBuffer #-}
260260
261−-- | Unsafely copy the elements of an array.
262−unsafeCopy :: A.Array -> Int -> A.MArray s -> Int -> Int -> ST s ()
263−unsafeCopy src sidx dest didx count =
264−#if defined(ASSERTS)
265− assert (sidx + count <= A.length src) .
266− assert (didx + count <= A.length dest) $
267−#endif
268− copy_loop sidx didx 0
269− where
270− copy_loop !i !j !c
271− | c >= count = return ()
272− | otherwise = do A.unsafeWrite dest j (A.unsafeIndex src i)
273− copy_loop (i+1) (j+1) (c+1)
274−{-# INLINE unsafeCopy #-}
275−
276261-- Write a character to the array, starting at the specified offset
277262-- @i@. Returns the number of elements written.
278263unsafeWrite :: A.MArray s -> Int -> Char -> ST s Int