on master help sign in
Deprecate internal funcs toStreamD, toStreamDRev
commit844da7dab877f9a39903f4804204fd819aa8f3bb authorHarendra Kumar <harendra@composewell.com> dateSun 31 Dec 2023, 05:16 (3 years ago) parent08e733d
3 files changed+21−20
core/src/Streamly/Internal/Data/Array.hs+1−1 core/src/Streamly/Internal/Data/Array/Type.hs+10−9 core/src/Streamly/Internal/Data/MutArray/Type.hs+10−10
core/src/Streamly/Internal/Data/Array.hs+1−1
@@ -331,7 +331,7 @@ splitOn :: (Monad m, Unbox a) =>
331331 (a -> Bool) -> Array a -> Stream m (Array a)
332332splitOn predicate arr =
333333 fmap (\(i, len) -> getSliceUnsafe i len arr)
334− $ D.indexOnSuffix predicate (A.toStreamD arr)
334+ $ D.indexOnSuffix predicate (A.read arr)
335335
336336{-# INLINE sliceIndexerFromLen #-}
337337sliceIndexerFromLen :: forall m a. (Monad m, Unbox a)
core/src/Streamly/Internal/Data/Array/Type.hs+10−9
@@ -63,12 +63,8 @@ module Streamly.Internal.Data.Array.Type
6363 , foldr
6464 , splitAt
6565
66− , toStreamD
67− , toStreamDRev
6866 , toStreamK
6967 , toStreamKRev
70− , toStream
71− , toStreamRev
7268 , read
7369 , readRev
7470 , readerRev
@@ -103,6 +99,10 @@ module Streamly.Internal.Data.Array.Type
10399 , fromArrayStreamK
104100 , fromStreamDN
105101 , fromStreamD
102+ , toStreamD
103+ , toStreamDRev
104+ , toStream
105+ , toStreamRev
106106 )
107107where
108108
@@ -494,18 +494,19 @@ length arr = MA.length (unsafeThaw arr)
494494readerRev :: forall m a. (Monad m, Unbox a) => Unfold m (Array a) a
495495readerRev = Unfold.lmap unsafeThaw $ MA.readerRevWith (return . unsafeInlineIO)
496496
497+{-# DEPRECATED toStreamD "Please use 'read' instead." #-}
497498{-# INLINE_NORMAL toStreamD #-}
498499toStreamD :: forall m a. (Monad m, Unbox a) => Array a -> D.Stream m a
499−toStreamD arr = MA.toStreamDWith (return . unsafeInlineIO) (unsafeThaw arr)
500+toStreamD = read
500501
501502{-# INLINE toStreamK #-}
502503toStreamK :: forall m a. (Monad m, Unbox a) => Array a -> K.StreamK m a
503504toStreamK arr = MA.toStreamKWith (return . unsafeInlineIO) (unsafeThaw arr)
504505
506+{-# DEPRECATED toStreamDRev "Please use 'readRev' instead." #-}
505507{-# INLINE_NORMAL toStreamDRev #-}
506508toStreamDRev :: forall m a. (Monad m, Unbox a) => Array a -> D.Stream m a
507−toStreamDRev arr =
508− MA.toStreamDRevWith (return . unsafeInlineIO) (unsafeThaw arr)
509+toStreamDRev = readRev
509510
510511{-# INLINE toStreamKRev #-}
511512toStreamKRev :: forall m a. (Monad m, Unbox a) => Array a -> K.StreamK m a
@@ -517,7 +518,7 @@ toStreamKRev arr =
517518-- /Pre-release/
518519{-# INLINE_EARLY read #-}
519520read :: (Monad m, Unbox a) => Array a -> Stream m a
520−read = toStreamD
521+read arr = MA.toStreamWith (return . unsafeInlineIO) (unsafeThaw arr)
521522
522523-- | Same as 'read'
523524--
@@ -534,7 +535,7 @@ toStream = read
534535-- /Pre-release/
535536{-# INLINE_EARLY readRev #-}
536537readRev :: (Monad m, Unbox a) => Array a -> Stream m a
537−readRev = toStreamDRev
538+readRev arr = MA.toStreamRevWith (return . unsafeInlineIO) (unsafeThaw arr)
538539
539540-- | Same as 'readRev'
540541--
core/src/Streamly/Internal/Data/MutArray/Type.hs+10−10
@@ -122,8 +122,8 @@ module Streamly.Internal.Data.MutArray.Type
122122 , readerRev
123123
124124 -- *** To containers
125− , toStreamDWith
126− , toStreamDRevWith
125+ , toStreamWith
126+ , toStreamRevWith
127127 , toStreamKWith
128128 , toStreamKRevWith
129129 , read
@@ -1609,11 +1609,11 @@ toList MutArray{..} = liftIO $ go arrStart
16091609 x <- peekAt p arrContents
16101610 (:) x <$> go (INDEX_NEXT(p,a))
16111611
1612−{-# INLINE_NORMAL toStreamDWith #-}
1613−toStreamDWith ::
1612+{-# INLINE_NORMAL toStreamWith #-}
1613+toStreamWith ::
16141614 forall m a. (Monad m, Unbox a)
16151615 => (forall b. IO b -> m b) -> MutArray a -> D.Stream m a
1616−toStreamDWith liftio MutArray{..} = D.Stream step arrStart
1616+toStreamWith liftio MutArray{..} = D.Stream step arrStart
16171617
16181618 where
16191619
@@ -1629,7 +1629,7 @@ toStreamDWith liftio MutArray{..} = D.Stream step arrStart
16291629--
16301630{-# INLINE_NORMAL read #-}
16311631read :: forall m a. (MonadIO m, Unbox a) => MutArray a -> D.Stream m a
1632−read = toStreamDWith liftIO
1632+read = toStreamWith liftIO
16331633
16341634{-# INLINE toStreamKWith #-}
16351635toStreamKWith ::
@@ -1648,11 +1648,11 @@ toStreamKWith liftio MutArray{..} = go arrStart
16481648toStreamK :: forall m a. (MonadIO m, Unbox a) => MutArray a -> StreamK m a
16491649toStreamK = toStreamKWith liftIO
16501650
1651−{-# INLINE_NORMAL toStreamDRevWith #-}
1652−toStreamDRevWith ::
1651+{-# INLINE_NORMAL toStreamRevWith #-}
1652+toStreamRevWith ::
16531653 forall m a. (Monad m, Unbox a)
16541654 => (forall b. IO b -> m b) -> MutArray a -> D.Stream m a
1655−toStreamDRevWith liftio MutArray{..} =
1655+toStreamRevWith liftio MutArray{..} =
16561656 let p = INDEX_PREV(arrEnd,a)
16571657 in D.Stream step p
16581658
@@ -1670,7 +1670,7 @@ toStreamDRevWith liftio MutArray{..} =
16701670--
16711671{-# INLINE_NORMAL readRev #-}
16721672readRev :: forall m a. (MonadIO m, Unbox a) => MutArray a -> D.Stream m a
1673−readRev = toStreamDRevWith liftIO
1673+readRev = toStreamRevWith liftIO
16741674
16751675{-# INLINE toStreamKRevWith #-}
16761676toStreamKRevWith ::