@@ -82,8 +82,8 @@ module Streamly.Internal.Data.Array.Foreign.Mut.Type
84 -- * Combining
84 -- * Combining
85− , spliceWith
85+ , splice
86− , spliceWithDoubling
86+ , spliceExp
87 , spliceTwo
87 , spliceTwo
89 -- * Splitting
89 -- * Splitting
@@ -1103,14 +1103,14 @@ spliceTwo arr1 arr2 = do
1103-- | Splice an array into a pre-reserved mutable array. The user must ensure
1103-- | Splice an array into a pre-reserved mutable array. The user must ensure
1104-- that there is enough space in the mutable array, otherwise the splicing
1104-- that there is enough space in the mutable array, otherwise the splicing
1105-- fails.
1105-- fails.
1106−{-# INLINE spliceWith #-}
1106+{-# INLINE splice #-}
1107−spliceWith :: (MonadIO m) => Array a -> Array a -> m (Array a)
1107+splice :: (MonadIO m) => Array a -> Array a -> m (Array a)
1108−spliceWith dst@(Array _ end bound) src =
1108+splice dst@(Array _ end bound) src =
1109 liftIO $ do
1109 liftIO $ do
1110 let srcLen = byteLength src
1110 let srcLen = byteLength src
1111 if end `plusPtr` srcLen > bound
1111 if end `plusPtr` srcLen > bound
1112 then error
1112 then error
1113− "Bug: spliceWith: Not enough space in the target array"
1113+ "Bug: splice: Not enough space in the target array"
1114 else unsafeWithForeignPtr (aStart dst) $ \_ ->
1114 else unsafeWithForeignPtr (aStart dst) $ \_ ->
1115 unsafeWithForeignPtr (aStart src) $ \psrc -> do
1115 unsafeWithForeignPtr (aStart src) $ \psrc -> do
1116 let pdst = aEnd dst
1116 let pdst = aEnd dst
@@ -1119,10 +1119,10 @@ spliceWith dst@(Array _ end bound) src =
1120-- | Splice a new array into a preallocated mutable array, doubling the space
1120-- | Splice a new array into a preallocated mutable array, doubling the space
1121-- if there is no space in the target array.
1121-- if there is no space in the target array.
1122−{-# INLINE spliceWithDoubling #-}
1122+{-# INLINE spliceExp #-}
1123−spliceWithDoubling :: (MonadIO m, Storable a)
1123+spliceExp :: (MonadIO m, Storable a)
1124 => Array a -> Array a -> m (Array a)
1124 => Array a -> Array a -> m (Array a)
1125−spliceWithDoubling dst@(Array start end bound) src = do
1125+spliceExp dst@(Array start end bound) src = do
1126 assert (end <= bound) (return ())
1126 assert (end <= bound) (return ())
1127 let srcLen = aEnd src `minusPtr` unsafeForeignPtrToPtr (aStart src)
1127 let srcLen = aEnd src `minusPtr` unsafeForeignPtrToPtr (aStart src)
@@ -1134,12 +1134,12 @@ spliceWithDoubling dst@(Array start end bound) src = do
1134 newSize = max (oldSize * 2) (oldSize + srcLen)
1134 newSize = max (oldSize * 2) (oldSize + srcLen)
1135 when (newSize < oldSize + srcLen)
1135 when (newSize < oldSize + srcLen)
1137− $ "spliceWith: newSize is less than the total size "
1137+ $ "splice: newSize is less than the total size "
1138 ++ "of arrays being appended. Please check the "
1138 ++ "of arrays being appended. Please check the "
1139 ++ "newSize function passed."
1139 ++ "newSize function passed."
1140 liftIO $ realloc newSize dst
1140 liftIO $ realloc newSize dst
1141 else return dst
1141 else return dst
1142− spliceWith dst1 src
1142+ splice dst1 src
1144-------------------------------------------------------------------------------
1144-------------------------------------------------------------------------------
1145-- Splitting
1145-- Splitting