@@ -28,6 +28,7 @@ module Streamly.Memory.Array.Types
28 , unsafeSnoc
28 , unsafeSnoc
30 , spliceWithDoubling
30 , spliceWithDoubling
32 , fromList
33 , fromList
33 , fromListN
34 , fromListN
@@ -45,6 +46,7 @@ module Streamly.Memory.Array.Types
45 , groupIOVecsOf
46 , groupIOVecsOf
49 -- * Elimination
51 -- * Elimination
50 , unsafeIndexIO
52 , unsafeIndexIO
@@ -942,6 +944,7 @@ unlines sep (D.Stream step state) = D.Stream step' (OuterLoop state)
942 return $ D.Yield x (InnerLoop st startf
944 return $ D.Yield x (InnerLoop st startf
943 (p `plusPtr` (sizeOf (undefined :: a))) end)
945 (p `plusPtr` (sizeOf (undefined :: a))) end)
947+-- Splice two immutable arrays creating a new array.
945{-# INLINE spliceTwo #-}
948{-# INLINE spliceTwo #-}
946spliceTwo :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
949spliceTwo :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
947spliceTwo arr1 arr2 = do
950spliceTwo arr1 arr2 = do
@@ -960,8 +963,8 @@ spliceTwo arr1 arr2 = do
960 touchForeignPtr (aStart arr2)
963 touchForeignPtr (aStart arr2)
961 return arr { aEnd = dst `plusPtr` (len1 + len2) }
964 return arr { aEnd = dst `plusPtr` (len1 + len2) }
963−-- Splice a new array into a pre-reserved array. The user must ensure that
966+-- Splice an array into a pre-reserved mutable array. The user must ensure
964−-- there is enough space in the array.
967+-- that there is enough space in the mutable array.
965{-# INLINE spliceWith #-}
968{-# INLINE spliceWith #-}
966spliceWith :: (MonadIO m) => Array a -> Array a -> m (Array a)
969spliceWith :: (MonadIO m) => Array a -> Array a -> m (Array a)
967spliceWith dst@(Array _ end bound) src = liftIO $ do
970spliceWith dst@(Array _ end bound) src = liftIO $ do
@@ -975,8 +978,8 @@ spliceWith dst@(Array _ end bound) src = liftIO $ do
975 memcpy (castPtr pdst) (castPtr psrc) srcLen
978 memcpy (castPtr pdst) (castPtr psrc) srcLen
976 return $ dst { aEnd = pdst `plusPtr` srcLen }
979 return $ dst { aEnd = pdst `plusPtr` srcLen }
978−-- Splice a new array into a preallocated array, doubling the space if there is
981+-- Splice a new array into a preallocated mutable array, doubling the space if
979−-- no space in the target array.
982+-- there is no space in the target array.
980{-# INLINE spliceWithDoubling #-}
983{-# INLINE spliceWithDoubling #-}
981spliceWithDoubling :: (MonadIO m, Storable a)
984spliceWithDoubling :: (MonadIO m, Storable a)
982 => Array a -> Array a -> m (Array a)
985 => Array a -> Array a -> m (Array a)