on master help sign in
Rename spliceTwo to spliceCopy
d20dcf4Harendra Kumar
src/Streamly/Internal/Data/Array/Foreign/Mut.hs+1−1
@@ -67,7 +67,7 @@ module Streamly.Internal.Data.Array.Foreign.Mut
67 -- * Combining
67 -- * Combining
68 , splice
68 , splice
69 , spliceExp
69 , spliceExp
70− , spliceTwo
70+ , spliceCopy
71
71
72 -- * Splitting
72 -- * Splitting
73 , breakOn
73 , breakOn
src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs+4−4
@@ -97,7 +97,7 @@ module Streamly.Internal.Data.Array.Foreign.Mut.Type
97 , spliceWith
97 , spliceWith
98 , splice
98 , splice
99 , spliceExp
99 , spliceExp
100− , spliceTwo
100+ , spliceCopy
101
101
102 -- * Splitting
102 -- * Splitting
103 , breakOn
103 , breakOn
@@ -1367,9 +1367,9 @@ fromList xs = fromStreamD $ D.fromList xs
1367-------------------------------------------------------------------------------
1367-------------------------------------------------------------------------------
1368
1368
1369-- | Copy two arrays into a newly allocated array.
1369-- | Copy two arrays into a newly allocated array.
1370−{-# INLINE spliceTwo #-}
1370+{-# INLINE spliceCopy #-}
1371−spliceTwo :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
1371+spliceCopy :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
1372−spliceTwo arr1 arr2 = do
1372+spliceCopy arr1 arr2 = do
1373 let src1 = unsafeForeignPtrToPtr (aStart arr1)
1373 let src1 = unsafeForeignPtrToPtr (aStart arr1)
1374 src2 = unsafeForeignPtrToPtr (aStart arr2)
1374 src2 = unsafeForeignPtrToPtr (aStart arr2)
1375 len1 = aEnd arr1 `minusPtr` src1
1375 len1 = aEnd arr1 `minusPtr` src1
src/Streamly/Internal/Data/Array/Foreign/Type.hs+6−6
@@ -22,7 +22,7 @@ module Streamly.Internal.Data.Array.Foreign.Type
22 , unsafeThaw
22 , unsafeThaw
23
23
24 -- * Construction
24 -- * Construction
25− , spliceTwo
25+ , splice
26
26
27 , fromPtr
27 , fromPtr
28 , fromAddr#
28 , fromAddr#
@@ -194,10 +194,10 @@ unsafeThaw (Array as ae) = MA.Array as ae ae
194-------------------------------------------------------------------------------
194-------------------------------------------------------------------------------
195
195
196-- Splice two immutable arrays creating a new array.
196-- Splice two immutable arrays creating a new array.
197−{-# INLINE spliceTwo #-}
197+{-# INLINE splice #-}
198−spliceTwo :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
198+splice :: (MonadIO m, Storable a) => Array a -> Array a -> m (Array a)
199−spliceTwo arr1 arr2 =
199+splice arr1 arr2 =
200− unsafeFreeze <$> MA.spliceTwo (unsafeThaw arr1) (unsafeThaw arr2)
200+ unsafeFreeze <$> MA.splice (unsafeThaw arr1) (unsafeThaw arr2)
201
201
202-- | Create an 'Array' of the given number of elements of type @a@ from a read
202-- | Create an 'Array' of the given number of elements of type @a@ from a read
203-- only pointer @Ptr a@. The pointer is not freed when the array is garbage
203-- only pointer @Ptr a@. The pointer is not freed when the array is garbage
@@ -671,7 +671,7 @@ instance Foldable Array where
671-------------------------------------------------------------------------------
671-------------------------------------------------------------------------------
672
672
673instance Storable a => Semigroup (Array a) where
673instance Storable a => Semigroup (Array a) where
674− arr1 <> arr2 = unsafePerformIO $ spliceTwo arr1 arr2
674+ arr1 <> arr2 = unsafePerformIO $ splice arr1 arr2
675
675
676nullForeignPtr :: ForeignPtr a
676nullForeignPtr :: ForeignPtr a
677nullForeignPtr = ForeignPtr nullAddr# (error "nullForeignPtr")
677nullForeignPtr = ForeignPtr nullAddr# (error "nullForeignPtr")
src/Streamly/Internal/Data/Array/Stream/Foreign.hs+3−3
@@ -265,7 +265,7 @@ _splitOn byte (D.Stream step state) = D.Stream step' (Initial state)
265 case r of
265 case r of
266 D.Yield arr s -> do
266 D.Yield arr s -> do
267 (arr1, marr2) <- A.breakOn byte arr
267 (arr1, marr2) <- A.breakOn byte arr
268− buf' <- A.spliceTwo buf arr1
268+ buf' <- A.splice buf arr1
269 return $ case marr2 of
269 return $ case marr2 of
270 Nothing -> D.Skip (Buffering s buf')
270 Nothing -> D.Skip (Buffering s buf')
271 Just x -> D.Skip (Yielding buf' (Splitting s x))
271 Just x -> D.Skip (Yielding buf' (Splitting s x))
@@ -295,7 +295,7 @@ splitOn
295 -> t m (Array Word8)
295 -> t m (Array Word8)
296 -> t m (Array Word8)
296 -> t m (Array Word8)
297splitOn byte s =
297splitOn byte s =
298− fromStreamD $ D.splitInnerBy (A.breakOn byte) A.spliceTwo $ toStreamD s
298+ fromStreamD $ D.splitInnerBy (A.breakOn byte) A.splice $ toStreamD s
299
299
300{-# INLINE splitOnSuffix #-}
300{-# INLINE splitOnSuffix #-}
301splitOnSuffix
301splitOnSuffix
@@ -305,7 +305,7 @@ splitOnSuffix
305 -> t m (Array Word8)
305 -> t m (Array Word8)
306-- splitOn byte s = fromStreamD $ A.splitOn byte $ toStreamD s
306-- splitOn byte s = fromStreamD $ A.splitOn byte $ toStreamD s
307splitOnSuffix byte s =
307splitOnSuffix byte s =
308− fromStreamD $ D.splitInnerBySuffix (A.breakOn byte) A.spliceTwo $ toStreamD s
308+ fromStreamD $ D.splitInnerBySuffix (A.breakOn byte) A.splice $ toStreamD s
309
309
310-------------------------------------------------------------------------------
310-------------------------------------------------------------------------------
311-- Elimination - Running folds
311-- Elimination - Running folds