@@ -122,7 +122,7 @@ copyLimit = 128
122fromText :: S.Text -> Builder
122fromText :: S.Text -> Builder
123fromText t@(Text arr off l)
123fromText t@(Text arr off l)
124 | S.null t = empty
124 | 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
126 | otherwise = flush `append` mapBuilder (t :)
126 | otherwise = flush `append` mapBuilder (t :)
127{-# INLINE [1] fromText #-}
127{-# INLINE [1] fromText #-}
@@ -258,21 +258,6 @@ newBuffer size = do
258 return $! Buffer arr 0 0 size
258 return $! Buffer arr 0 0 size
259{-# INLINE newBuffer #-}
259{-# INLINE newBuffer #-}
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 =
265− assert (sidx + count <= A.length src) .
266− assert (didx + count <= A.length dest) $
268− copy_loop sidx didx 0
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 #-}
276-- Write a character to the array, starting at the specified offset
261-- Write a character to the array, starting at the specified offset
277-- @i@. Returns the number of elements written.
262-- @i@. Returns the number of elements written.
278unsafeWrite :: A.MArray s -> Int -> Char -> ST s Int
263unsafeWrite :: A.MArray s -> Int -> Char -> ST s Int