diff --git a/core/src/Streamly/Data/Stream.hs b/core/src/Streamly/Data/Stream.hs index beec12fa0c..7dc77af07c 100644 --- a/core/src/Streamly/Data/Stream.hs +++ b/core/src/Streamly/Data/Stream.hs @@ -763,7 +763,6 @@ module Streamly.Data.Stream , scanMaybe , postscan , splitOn - , splitOnSeq , unfoldMany , intercalate , intercalateSuffix diff --git a/core/src/Streamly/Internal/Data/Array.hs b/core/src/Streamly/Internal/Data/Array.hs index 9e2657f8d0..42715819d1 100644 --- a/core/src/Streamly/Internal/Data/Array.hs +++ b/core/src/Streamly/Internal/Data/Array.hs @@ -88,7 +88,6 @@ module Streamly.Internal.Data.Array , deserialize -- * Deprecated - , sliceEndBy_ , slicerFromLen , sliceIndexerFromLen , castUnsafe @@ -267,10 +266,9 @@ getSliceUnsafe :: -> Array a RENAME(getSliceUnsafe,unsafeSliceOffLen) -sliceEndBy_, splitOn :: (Monad m, Unbox a) => +splitOn :: (Monad m, Unbox a) => (a -> Bool) -> Array a -> Stream m (Array a) RENAME(splitOn,splitEndBy_) -RENAME(sliceEndBy_,splitEndBy_) {-# INLINE indexerFromLen #-} indexerFromLen, sliceIndexerFromLen :: forall m a. (Monad m, Unbox a) diff --git a/core/src/Streamly/Internal/Data/Array/Generic/Type.hs b/core/src/Streamly/Internal/Data/Array/Generic/Type.hs index 3e1c6cf128..ecdbbc2e57 100644 --- a/core/src/Streamly/Internal/Data/Array/Generic/Type.hs +++ b/core/src/Streamly/Internal/Data/Array/Generic/Type.hs @@ -56,7 +56,6 @@ module Streamly.Internal.Data.Array.Generic.Type , strip , getIndexUnsafe , getSliceUnsafe - , unsafeGetSlice , writeN , write , fromByteStr# @@ -302,7 +301,7 @@ createOfLast n = FL.rmapM f (RB.createOf n) return $ unsafeFreeze arr {-# INLINE unsafeSliceOffLen #-} -unsafeSliceOffLen, getSliceUnsafe, unsafeGetSlice +unsafeSliceOffLen, getSliceUnsafe :: Int -> Int -> Array a -> Array a unsafeSliceOffLen offset len = unsafeFreeze . MArray.unsafeSliceOffLen offset len . unsafeThaw @@ -372,7 +371,6 @@ instance Read a => Read (Array a) where RENAME(strip,dropAround) RENAME(getSliceUnsafe,unsafeSliceOffLen) -RENAME(unsafeGetSlice,unsafeSliceOffLen) RENAME(getIndexUnsafe,unsafeGetIndex) -------------------------------------------------------------------------------- diff --git a/core/src/Streamly/Internal/Data/Array/Type.hs b/core/src/Streamly/Internal/Data/Array/Type.hs index 6772255acc..afd125ae0d 100644 --- a/core/src/Streamly/Internal/Data/Array/Type.hs +++ b/core/src/Streamly/Internal/Data/Array/Type.hs @@ -169,13 +169,8 @@ module Streamly.Internal.Data.Array.Type , compactMin -- ** Deprecated - , unsafeGetSlice - , strip - , stripStart - , stripEnd , breakOn , splitAt - , unsafeSplitAt , asPtrUnsafe , unsafeIndex , bufferChunks @@ -550,7 +545,7 @@ fromStreamD = fromStream -- -- /Pre-release/ {-# INLINE unsafeSliceOffLen #-} -unsafeSliceOffLen, unsafeGetSlice :: +unsafeSliceOffLen :: forall a. Unbox a => Int -- ^ starting index -> Int -- ^ length of the slice @@ -561,7 +556,6 @@ unsafeSliceOffLen index len (Array contents start e) = start1 = start + (index * size) end1 = start1 + (len * size) in assert (end1 <= e) (Array contents start1 end1) -RENAME(unsafeGetSlice,unsafeSliceOffLen) ------------------------------------------------------------------------------- -- Elimination @@ -1022,14 +1016,13 @@ foldr f z arr = runIdentity $ D.foldr f z $ toStreamD arr -- | Like 'breakAt' but does not check whether the index is valid. -- {-# INLINE unsafeBreakAt #-} -unsafeBreakAt, unsafeSplitAt :: Unbox a => +unsafeBreakAt :: Unbox a => Int -> Array a -> (Array a, Array a) unsafeBreakAt i arr = (unsafeFreeze a, unsafeFreeze b) where (a, b) = MA.unsafeBreakAt i (unsafeThaw arr) -RENAME(unsafeSplitAt,unsafeBreakAt) -- | Create two slices of an array without copying the original array. The -- specified index @i@ is the first index of the second slice. @@ -1081,28 +1074,25 @@ revBreakEndBy_ p arr = (unsafeFreeze a, unsafeFreeze b) -- -- /Pre-release/ {-# INLINE dropAround #-} -dropAround, strip :: Unbox a => (a -> Bool) -> Array a -> Array a +dropAround :: Unbox a => (a -> Bool) -> Array a -> Array a dropAround eq arr = unsafeFreeze $ unsafePerformIO $ MA.dropAround eq (unsafeThaw arr) -RENAME(strip,dropAround) -- | Strip elements which match the predicate, from the start of the array. -- -- /Pre-release/ {-# INLINE dropWhile #-} -dropWhile, stripStart :: Unbox a => (a -> Bool) -> Array a -> Array a +dropWhile :: Unbox a => (a -> Bool) -> Array a -> Array a dropWhile eq arr = unsafeFreeze $ unsafePerformIO $ MA.dropWhile eq (unsafeThaw arr) -RENAME(stripStart,dropWhile) -- | Strip elements which match the predicate, from the end of the array. -- -- /Pre-release/ {-# INLINE revDropWhile #-} -revDropWhile, stripEnd :: Unbox a => (a -> Bool) -> Array a -> Array a +revDropWhile :: Unbox a => (a -> Bool) -> Array a -> Array a revDropWhile eq arr = unsafeFreeze $ unsafePerformIO $ MA.revDropWhile eq (unsafeThaw arr) -RENAME(stripEnd,revDropWhile) -- Use foldr/build fusion to fuse with list consumers -- This can be useful when using the IsList instance diff --git a/core/src/Streamly/Internal/Data/IORef.hs b/core/src/Streamly/Internal/Data/IORef.hs index 32126b568a..c4fad390fa 100644 --- a/core/src/Streamly/Internal/Data/IORef.hs +++ b/core/src/Streamly/Internal/Data/IORef.hs @@ -34,9 +34,6 @@ module Streamly.Internal.Data.IORef , readIORef , pollGenericIORef , pollIORefInt - - -- Deprecated - , pollIntIORef ) where @@ -103,11 +100,6 @@ pollGenericIORef var = D.Stream step () {-# INLINE_LATE step #-} step _ () = liftIO (readIORef var) >>= \x -> return $ D.Yield x () -{-# DEPRECATED pollIntIORef "Use pollIORefInt instead." #-} -{-# INLINE_NORMAL pollIntIORef #-} -pollIntIORef :: (MonadIO m, Unbox a) => IORef a -> D.Stream m a -pollIntIORef = pollGenericIORef - -- | Generate a stream by continuously reading the IORef. -- -- This operation reads the IORef without any synchronization. It can be diff --git a/core/src/Streamly/Internal/Data/MutArray/Generic.hs b/core/src/Streamly/Internal/Data/MutArray/Generic.hs index dd4ddfeeeb..8c3ba0c77c 100644 --- a/core/src/Streamly/Internal/Data/MutArray/Generic.hs +++ b/core/src/Streamly/Internal/Data/MutArray/Generic.hs @@ -165,7 +165,6 @@ module Streamly.Internal.Data.MutArray.Generic , clone -- * Deprecated - , unsafeGetSlice , getSlice , strip , new @@ -537,7 +536,7 @@ getIndex i arr = -- -- /Pre-release/ {-# INLINE unsafeSliceOffLen #-} -unsafeSliceOffLen, getSliceUnsafe, unsafeGetSlice +unsafeSliceOffLen, getSliceUnsafe :: Int -- ^ from index -> Int -- ^ length of the slice -> MutArray a @@ -977,7 +976,6 @@ RENAME(modifyIndexUnsafe, unsafeModifyIndex) RENAME(getIndexUnsafe, unsafeGetIndex) RENAME(getIndexUnsafeWith, unsafeGetIndexWith) RENAME(getSliceUnsafe,unsafeSliceOffLen) -RENAME(unsafeGetSlice,unsafeSliceOffLen) RENAME(putSliceUnsafe, unsafePutSlice) RENAME(getSlice,sliceOffLen) RENAME(snocUnsafe, unsafeSnoc) diff --git a/core/src/Streamly/Internal/Data/MutArray/Type.hs b/core/src/Streamly/Internal/Data/MutArray/Type.hs index f6cef3f73f..5a0faccd26 100644 --- a/core/src/Streamly/Internal/Data/MutArray/Type.hs +++ b/core/src/Streamly/Internal/Data/MutArray/Type.hs @@ -421,15 +421,10 @@ module Streamly.Internal.Data.MutArray.Type , roundUpToPower2 -- * Deprecated - , unsafeGetSlice , getSlice - , sliceEndBy_ , strip - , stripStart - , stripEnd , breakOn , splitAt - , unsafeSplitAt , realloc , createOfWith , peekUncons @@ -1615,7 +1610,7 @@ getIndices = indexReader -- -- /Pre-release/ {-# INLINE unsafeSliceOffLen #-} -unsafeSliceOffLen, getSliceUnsafe, unsafeGetSlice :: forall a. Unbox a +unsafeSliceOffLen, getSliceUnsafe :: forall a. Unbox a => Int -- ^ from index -> Int -- ^ length of the slice -> MutArray a @@ -3325,12 +3320,11 @@ splitUsing f predicate arr = -- -- /Pre-release/ {-# INLINE splitEndBy_ #-} -splitEndBy_, sliceEndBy_, splitOn :: (MonadIO m, Unbox a) => +splitEndBy_, splitOn :: (MonadIO m, Unbox a) => (a -> Bool) -> MutArray a -> Stream m (MutArray a) splitEndBy_ = splitUsing D.indexEndBy_ RENAME(splitOn,splitEndBy_) -RENAME(sliceEndBy_,splitEndBy_) -- | Generate a stream of array slices using a predicate. The array element -- matching the predicate is included. @@ -3484,7 +3478,7 @@ RENAME(breakOn,breakEndByWord8_) -- >>> unsafeBreakAt i arr = (MutArray.unsafeSliceOffLen 0 i arr, MutArray.unsafeSliceOffLen i (MutArray.length arr - i) arr) -- {-# INLINE unsafeBreakAt #-} -unsafeBreakAt, unsafeSplitAt :: forall a. Unbox a => +unsafeBreakAt :: forall a. Unbox a => Int -> MutArray a -> (MutArray a, MutArray a) unsafeBreakAt i MutArray{..} = -- (unsafeSliceOffLen 0 i arr, unsafeSliceOffLen i (length arr - i) arr) @@ -3503,7 +3497,6 @@ unsafeBreakAt i MutArray{..} = , arrBound = arrBound } ) -RENAME(unsafeSplitAt,unsafeBreakAt) -- | Create two slices of an array without copying the original array. The -- specified index @i@ is the first index of the second slice. @@ -4131,7 +4124,7 @@ retractEndTill eq MutArray{..} = go arrEnd -- -- /Pre-release/ {-# INLINE dropWhile #-} -dropWhile, stripStart :: forall a m. (Unbox a, MonadIO m) => +dropWhile :: forall a m. (Unbox a, MonadIO m) => (a -> Bool) -> MutArray a -> m (MutArray a) dropWhile eq arr@MutArray{..} = liftIO $ do st <- advanceStartTill eq arr @@ -4140,7 +4133,6 @@ dropWhile eq arr@MutArray{..} = liftIO $ do if st >= arrEnd then empty else arr{arrStart = st} -RENAME(stripStart,dropWhile) -- | Strip elements which match the predicate, from the end of the array. -- @@ -4151,7 +4143,7 @@ RENAME(stripStart,dropWhile) -- -- /Pre-release/ {-# INLINE revDropWhile #-} -revDropWhile, stripEnd :: forall a m. (Unbox a, MonadIO m) => +revDropWhile :: forall a m. (Unbox a, MonadIO m) => (a -> Bool) -> MutArray a -> m (MutArray a) revDropWhile eq arr@MutArray{..} = liftIO $ do end <- retractEndTill eq arr @@ -4160,7 +4152,6 @@ revDropWhile eq arr@MutArray{..} = liftIO $ do if end <= arrStart then empty else arr{arrEnd = end} -RENAME(stripEnd,revDropWhile) -- | Strip elements which match the predicate, from both ends. -- @@ -4211,7 +4202,6 @@ RENAME(realloc,reallocBytes) RENAME(castUnsafe,unsafeCast) RENAME(newArrayWith,emptyWithAligned) RENAME(getSliceUnsafe,unsafeSliceOffLen) -RENAME(unsafeGetSlice,unsafeSliceOffLen) RENAME(getSlice,sliceOffLen) RENAME(putIndexUnsafe,unsafePutIndex) RENAME(modifyIndexUnsafe,unsafeModifyIndex) diff --git a/core/src/Streamly/Internal/Data/Stream/Nesting.hs b/core/src/Streamly/Internal/Data/Stream/Nesting.hs index 98c4e34dfe..30f93dc0da 100644 --- a/core/src/Streamly/Internal/Data/Stream/Nesting.hs +++ b/core/src/Streamly/Internal/Data/Stream/Nesting.hs @@ -214,9 +214,6 @@ module Streamly.Internal.Data.Stream.Nesting , parseIterateD , groupsBy , splitOnSeq - , unfoldEachInterleave - , unfoldEachInterleaveRev - , unfoldEachRoundRobin ) where @@ -790,7 +787,7 @@ data BfsUnfoldEachState o i = -- CAUTION! Do not use on infinite streams. -- {-# INLINE_NORMAL bfsUnfoldEach #-} -bfsUnfoldEach, unfoldEachInterleave :: Monad m => +bfsUnfoldEach :: Monad m => Unfold m a b -> Stream m a -> Stream m b bfsUnfoldEach (Unfold istep inject) (Stream ostep ost) = Stream step (BfsUnfoldEachOuter ost id) @@ -819,8 +816,6 @@ bfsUnfoldEach (Unfold istep inject) (Stream ostep ost) = Skip s -> Skip (BfsUnfoldEachInner (s:ls) rs) Stop -> Skip (BfsUnfoldEachInner ls rs) -RENAME(unfoldEachInterleave, bfsUnfoldEach) - data ConcatUnfoldInterleaveState o i = ConcatUnfoldInterleaveOuter o [i] | ConcatUnfoldInterleaveInner o [i] @@ -839,7 +834,7 @@ data ConcatUnfoldInterleaveState o i = -- CAUTION! Do not use on infinite streams. -- {-# INLINE_NORMAL altBfsUnfoldEach #-} -altBfsUnfoldEach, unfoldEachInterleaveRev, unfoldInterleave :: Monad m => +altBfsUnfoldEach, unfoldInterleave :: Monad m => Unfold m a b -> Stream m a -> Stream m b altBfsUnfoldEach (Unfold istep inject) (Stream ostep ost) = Stream step (ConcatUnfoldInterleaveOuter ost []) @@ -887,7 +882,6 @@ altBfsUnfoldEach (Unfold istep inject) (Stream ostep ost) = Stop -> Skip (ConcatUnfoldInterleaveInnerR ls rs) RENAME(unfoldInterleave,altBfsUnfoldEach) -RENAME(unfoldEachInterleaveRev,altBfsUnfoldEach) -- XXX In general we can use different scheduling strategies e.g. how to -- schedule the outer vs inner loop or assigning weights to different streams @@ -911,7 +905,7 @@ RENAME(unfoldEachInterleaveRev,altBfsUnfoldEach) -- CAUTION! Do not use on infinite streams. -- {-# INLINE_NORMAL unfoldSched #-} -unfoldSched, unfoldEachRoundRobin, unfoldRoundRobin :: Monad m => +unfoldSched, unfoldRoundRobin :: Monad m => Unfold m a b -> Stream m a -> Stream m b unfoldSched (Unfold istep inject) (Stream ostep ost) = Stream step (BfsUnfoldEachOuter ost id) @@ -941,7 +935,6 @@ unfoldSched (Unfold istep inject) (Stream ostep ost) = Stop -> Skip (BfsUnfoldEachInner ls rs) RENAME(unfoldRoundRobin,unfoldSched) -RENAME(unfoldEachRoundRobin,unfoldSched) -- | Round robin co-operative scheduling of multiple streams. -- diff --git a/core/src/Streamly/Internal/Data/Unfold/Type.hs b/core/src/Streamly/Internal/Data/Unfold/Type.hs index 042f5c57ce..584f4814bc 100644 --- a/core/src/Streamly/Internal/Data/Unfold/Type.hs +++ b/core/src/Streamly/Internal/Data/Unfold/Type.hs @@ -113,7 +113,6 @@ module Streamly.Internal.Data.Unfold.Type , map2 , mapM2 , takeWhileMWithInput - , unfoldEach2 ) where @@ -581,11 +580,11 @@ crossApplyFst (Unfold _step1 _inject1) (Unfold _step2 _inject2) = undefined data Many2State x s1 s2 = Many2Outer x s1 | Many2Inner x s1 s2 -} -{-# DEPRECATED unfoldEach2 "Use carry with unfoldEach instead." #-} -{-# INLINE_NORMAL unfoldEach2 #-} -unfoldEach2, many2 :: Monad m => +{-# DEPRECATED many2 "Use carry with unfoldEach instead." #-} +{-# INLINE_NORMAL many2 #-} +many2 :: Monad m => Unfold m (a, b) c -> Unfold m a b -> Unfold m a c -unfoldEach2 u1 u2 = unfoldEach u1 (carry u2) +many2 u1 u2 = unfoldEach u1 (carry u2) {- unfoldEach2 (Unfold step2 inject2) (Unfold step1 inject1) = Unfold step inject @@ -613,8 +612,6 @@ unfoldEach2 (Unfold step2 inject2) (Unfold step1 inject1) = Unfold step inject Stop -> Skip (Many2Outer a ost) -} -RENAME(many2,unfoldEach2) - data Cross a s1 b s2 = CrossOuter a s1 | CrossInner a s1 b s2 -- >> f1 f u = Unfold.mapM (\((_, c), b) -> f b c) Unfold.carry (Unfold.lmap fst u)) diff --git a/core/src/Streamly/Internal/FileSystem/FileIO.hs b/core/src/Streamly/Internal/FileSystem/FileIO.hs index 816911ed7e..6b3446da14 100644 --- a/core/src/Streamly/Internal/FileSystem/FileIO.hs +++ b/core/src/Streamly/Internal/FileSystem/FileIO.hs @@ -78,16 +78,6 @@ module Streamly.Internal.FileSystem.FileIO -- , appendShared , writeAppendArray , writeAppendChunks - - -- * Deprecated - , readWithBufferOf - , readChunksWithBufferOf - , readChunksFromToWith - , toBytes - , toChunks - , toChunksWithBufferOf - , writeWithBufferOf - , fromBytesWithBufferOf ) where @@ -235,12 +225,6 @@ readChunksWith :: (MonadIO m, MonadCatch m) readChunksWith size file = withFile file ReadMode (FH.readChunksWith size) -{-# DEPRECATED toChunksWithBufferOf "Please use 'readChunksWith' instead" #-} -{-# INLINE toChunksWithBufferOf #-} -toChunksWithBufferOf :: (MonadIO m, MonadCatch m) - => Int -> Path -> Stream m (Array Word8) -toChunksWithBufferOf = readChunksWith - -- XXX read 'Array a' instead of Word8 -- -- | @readChunks file@ reads a stream of arrays from file @file@. @@ -256,11 +240,6 @@ readChunks :: (MonadIO m, MonadCatch m) => Path -> Stream m (Array Word8) readChunks = readChunksWith defaultChunkSize -{-# DEPRECATED toChunks "Please use 'readChunks' instead" #-} -{-# INLINE toChunks #-} -toChunks :: (MonadIO m, MonadCatch m) => Path -> Stream m (Array Word8) -toChunks = readChunks - ------------------------------------------------------------------------------- -- Read File to Stream ------------------------------------------------------------------------------- @@ -281,13 +260,6 @@ chunkReaderWith :: (MonadIO m, MonadCatch m) => Unfold m (Int, Path) (Array Word8) chunkReaderWith = usingFile2 FH.chunkReaderWith -{-# DEPRECATED readChunksWithBufferOf - "Please use 'chunkReaderWith' instead" #-} -{-# INLINE readChunksWithBufferOf #-} -readChunksWithBufferOf :: (MonadIO m, MonadCatch m) - => Unfold m (Int, Path) (Array Word8) -readChunksWithBufferOf = chunkReaderWith - -- | Unfold the tuple @(from, to, bufsize, filepath)@ into a stream -- of 'Word8' arrays. -- Read requests to the IO device are performed using a buffer of size @@ -301,13 +273,6 @@ chunkReaderFromToWith :: (MonadIO m, MonadCatch m) => Unfold m (Int, Int, Int, Path) (Array Word8) chunkReaderFromToWith = usingFile3 FH.chunkReaderFromToWith -{-# DEPRECATED readChunksFromToWith - "Please use 'chunkReaderFromToWith' instead" #-} -{-# INLINE readChunksFromToWith #-} -readChunksFromToWith :: (MonadIO m, MonadCatch m) => - Unfold m (Int, Int, Int, Path) (Array Word8) -readChunksFromToWith = chunkReaderFromToWith - -- | Unfolds a 'Path' into a stream of 'Word8' arrays. Requests to the IO -- device are performed using a buffer of size -- 'Streamly.Internal.Data.Array.Type.defaultChunkSize'. The @@ -327,12 +292,6 @@ chunkReader = usingFile FH.chunkReader readerWith :: (MonadIO m, MonadCatch m) => Unfold m (Int, Path) Word8 readerWith = usingFile2 FH.readerWith -{-# DEPRECATED readWithBufferOf "Please use 'readerWith' instead" #-} -{-# INLINE readWithBufferOf #-} -readWithBufferOf :: (MonadIO m, MonadCatch m) => - Unfold m (Int, Path) Word8 -readWithBufferOf = readerWith - -- | Unfolds a file path into a byte stream. IO requests to the device are -- performed in sizes of -- 'Streamly.Internal.Data.Array.Type.defaultChunkSize'. @@ -352,11 +311,6 @@ reader = UF.unfoldEach A.reader (usingFile FH.chunkReader) read :: (MonadIO m, MonadCatch m) => Path -> Stream m Word8 read file = A.concat $ withFile file ReadMode FH.readChunks -{-# DEPRECATED toBytes "Please use 'read' instead" #-} -{-# INLINE toBytes #-} -toBytes :: (MonadIO m, MonadCatch m) => Path -> Stream m Word8 -toBytes = read - {- -- | Generate a stream of elements of the given type from a file 'Handle'. The -- stream ends when EOF is encountered. File is not locked for exclusive reads, @@ -406,12 +360,6 @@ fromBytesWith :: (MonadIO m, MonadCatch m) => Int -> Path -> Stream m Word8 -> m () fromBytesWith n file xs = fromChunks file $ A.chunksOf' n xs -{-# DEPRECATED fromBytesWithBufferOf "Please use 'fromBytesWith' instead" #-} -{-# INLINE fromBytesWithBufferOf #-} -fromBytesWithBufferOf :: (MonadIO m, MonadCatch m) - => Int -> Path -> Stream m Word8 -> m () -fromBytesWithBufferOf = fromBytesWith - -- > write = 'writeWith' defaultChunkSize -- -- | Write a byte stream to a file. Combines the bytes in chunks of size @@ -468,12 +416,6 @@ writeWith :: (MonadIO m, MonadCatch m) writeWith n path = groupsOf n (A.unsafeCreateOf' n) (writeChunks path) -{-# DEPRECATED writeWithBufferOf "Please use 'writeWith' instead" #-} -{-# INLINE writeWithBufferOf #-} -writeWithBufferOf :: (MonadIO m, MonadCatch m) - => Int -> Path -> Fold m Word8 () -writeWithBufferOf = writeWith - -- > write = 'writeWith' A.defaultChunkSize -- -- | Write a byte stream to a file. Accumulates the input in chunks of up to