on master help sign in
mark unreleased APIs as internal
commitfe8c6e7172c2619b18d7f6d07edf485d6d2f9c15 authorHarendra Kumar <harendra@composewell.com> dateThu 27 Feb 2020, 17:47 (7 years ago) parente966465
4 files changed+48−30
src/Streamly/Internal/Data/Stream/Combinators.hs+3 src/Streamly/Internal/Data/Stream/Parallel.hs+3−3 src/Streamly/Internal/Data/Stream/StreamK.hs+2 src/Streamly/Internal/Prelude.hs+40−27
src/Streamly/Internal/Data/Stream/Combinators.hs+3
@@ -212,6 +212,9 @@ printState st = liftIO $ do
212212 Nothing -> putStrLn "No SVar"
213213
214214-- | Print debug information about an SVar when the stream ends
215+--
216+-- /Internal/
217+--
215218inspectMode :: IsStream t => t m a -> t m a
216219inspectMode m = mkStream $ \st stp sng yld ->
217220 foldStreamShared (setInspectMode st) stp sng yld m
src/Streamly/Internal/Data/Stream/Parallel.hs+3−3
@@ -226,7 +226,7 @@ parallel = joinStreamVarPar ParallelVar StopNone
226226--
227227-- | Like `parallel` but stops the output as soon as the first stream stops.
228228--
229−-- @since 0.7.0
229+-- /Internal/
230230{-# INLINE parallelFst #-}
231231parallelFst :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a
232232parallelFst = joinStreamVarPar ParallelVar StopBy
@@ -236,7 +236,7 @@ parallelFst = joinStreamVarPar ParallelVar StopBy
236236-- | Like `parallel` but stops the output as soon as any of the two streams
237237-- stops.
238238--
239−-- @since 0.7.0
239+-- /Internal/
240240{-# INLINE parallelMin #-}
241241parallelMin :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a
242242parallelMin = joinStreamVarPar ParallelVar StopAny
@@ -364,7 +364,7 @@ newFoldSVar stt f = do
364364--
365365-- Compare with 'tap'.
366366--
367−-- @since 0.7.0
367+-- /Internal/
368368{-# INLINE tapAsync #-}
369369tapAsync :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> t m a
370370tapAsync f m = mkStream $ \st yld sng stp -> do
src/Streamly/Internal/Data/Stream/StreamK.hs+2
@@ -549,6 +549,8 @@ tailPartial m = mkStream $ \st yld sng stp ->
549549--
550550-- Note that the function `f` must be lazy in its argument, that's why we use
551551-- 'unsafeInterleaveIO' because IO monad is strict.
552+--
553+-- /Internal/
552554
553555mfix :: (IsStream t, Monad m) => (m a -> t m a) -> t m a
554556mfix f = mkStream $ \st yld sng stp ->
src/Streamly/Internal/Prelude.hs+40−27
@@ -175,6 +175,7 @@ module Streamly.Internal.Prelude
175175 , Serial.map
176176 , sequence
177177 , mapM
178+
178179 -- ** Special Maps
179180 , mapM_
180181 , trace
@@ -1074,7 +1075,7 @@ foldrM = P.foldrM
10741075--
10751076-- > foldrM f z s = runIdentityT $ foldrS (\x xs -> lift $ f x (runIdentityT xs)) (lift z) s
10761077--
1077−-- @since 0.7.0
1078+-- /Internal/
10781079{-# INLINE foldrS #-}
10791080foldrS :: IsStream t => (a -> t m b -> t m b) -> t m b -> t m a -> t m b
10801081foldrS = K.foldrS
@@ -1089,7 +1090,7 @@ foldrS = K.foldrS
10891090-- 'foldrT' can be used to translate streamly streams to other transformer
10901091-- monads e.g. to a different streaming type.
10911092--
1092−-- @since 0.7.0
1093+-- /Internal/
10931094{-# INLINE foldrT #-}
10941095foldrT :: (IsStream t, Monad m, Monad (s m), MonadTrans s)
10951096 => (a -> s m b -> s m b) -> s m b -> t m a -> s m b
@@ -1779,6 +1780,9 @@ x |&. f = f |$. x
17791780------------------------------------------------------------------------------
17801781
17811782-- | Use a 'Pipe' to transform a stream.
1783+--
1784+-- /Internal/
1785+--
17821786{-# INLINE transform #-}
17831787transform :: (IsStream t, Monad m) => Pipe m a b -> t m a -> t m b
17841788transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs)
@@ -1889,7 +1893,7 @@ postscanlM' step z m = fromStreamD $ D.postscanlM' step z $ toStreamD m
18891893--
18901894-- | Like scanl' but does not stream the final value of the accumulator.
18911895--
1892−-- @since 0.6.0
1896+-- /Internal/
18931897{-# INLINE prescanl' #-}
18941898prescanl' :: (IsStream t, Monad m) => (b -> a -> b) -> b -> t m a -> t m b
18951899prescanl' step z m = fromStreamD $ D.prescanl' step z $ toStreamD m
@@ -1897,7 +1901,7 @@ prescanl' step z m = fromStreamD $ D.prescanl' step z $ toStreamD m
18971901-- XXX this needs to be concurrent
18981902-- | Like postscanl' but with a monadic step function.
18991903--
1900−-- @since 0.6.0
1904+-- /Internal/
19011905{-# INLINE prescanlM' #-}
19021906prescanlM' :: (IsStream t, Monad m) => (b -> a -> m b) -> m b -> t m a -> t m b
19031907prescanlM' step z m = fromStreamD $ D.prescanlM' step z $ toStreamD m
@@ -2208,7 +2212,7 @@ reverse s = fromStreamS $ S.reverse $ toStreamS s
22082212
22092213-- | Like 'reverse' but several times faster, requires a 'Storable' instance.
22102214--
2211−-- @since 0.7.0
2215+-- /Internal/
22122216{-# INLINE reverse' #-}
22132217reverse' :: (IsStream t, MonadIO m, Storable a) => t m a -> t m a
22142218reverse' s = fromStreamD $ D.reverse' $ toStreamD s
@@ -2248,7 +2252,7 @@ intersperse a = fromStreamS . S.intersperse a . toStreamS
22482252
22492253-- | Insert a monadic action after each element in the stream.
22502254--
2251−-- @since 0.7.0
2255+-- /Internal/
22522256{-# INLINE intersperseSuffix #-}
22532257intersperseSuffix :: (IsStream t, MonadAsync m) => m a -> t m a -> t m a
22542258intersperseSuffix m = fromStreamD . D.intersperseSuffix m . toStreamD
@@ -2314,7 +2318,7 @@ intersperseBySpan _n _f _xs = undefined
23142318-- "h,e,l,l,o"
23152319-- @
23162320--
2317−-- @since 0.7.0
2321+-- /Internal/
23182322{-# INLINE interjectSuffix #-}
23192323interjectSuffix
23202324 :: (IsStream t, MonadAsync m)
@@ -2573,7 +2577,7 @@ concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
25732577-- but use 'concatMap' or 'concatMapWith serial' for appending @n@ streams or
25742578-- infinite containers of streams.
25752579--
2576−-- @since 0.7.0
2580+-- /Internal/
25772581{-# INLINE append #-}
25782582append ::(IsStream t, Monad m) => t m b -> t m b -> t m b
25792583append m1 m2 = fromStreamD $ D.append (toStreamD m1) (toStreamD m2)
@@ -2600,7 +2604,7 @@ append m1 m2 = fromStreamD $ D.append (toStreamD m1) (toStreamD m2)
26002604--
26012605-- Do not use at scale in concatMapWith.
26022606--
2603−-- @since 0.7.0
2607+-- /Internal/
26042608{-# INLINE interleave #-}
26052609interleave ::(IsStream t, Monad m) => t m b -> t m b -> t m b
26062610interleave m1 m2 = fromStreamD $ D.interleave (toStreamD m1) (toStreamD m2)
@@ -2622,7 +2626,7 @@ interleave m1 m2 = fromStreamD $ D.interleave (toStreamD m1) (toStreamD m2)
26222626--
26232627-- Do not use at scale in concatMapWith.
26242628--
2625−-- @since 0.7.0
2629+-- /Internal/
26262630{-# INLINE interleaveSuffix #-}
26272631interleaveSuffix ::(IsStream t, Monad m) => t m b -> t m b -> t m b
26282632interleaveSuffix m1 m2 =
@@ -2645,7 +2649,7 @@ interleaveSuffix m1 m2 =
26452649--
26462650-- Do not use at scale in concatMapWith.
26472651--
2648−-- @since 0.7.0
2652+-- /Internal/
26492653{-# INLINE interleaveInfix #-}
26502654interleaveInfix ::(IsStream t, Monad m) => t m b -> t m b -> t m b
26512655interleaveInfix m1 m2 =
@@ -2667,7 +2671,7 @@ interleaveInfix m1 m2 =
26672671--
26682672-- Do not use at scale in concatMapWith.
26692673--
2670−-- @since 0.7.0
2674+-- /Internal/
26712675{-# INLINE interleaveMin #-}
26722676interleaveMin ::(IsStream t, Monad m) => t m b -> t m b -> t m b
26732677interleaveMin m1 m2 = fromStreamD $ D.interleaveMin (toStreamD m1) (toStreamD m2)
@@ -2683,7 +2687,7 @@ interleaveMin m1 m2 = fromStreamD $ D.interleaveMin (toStreamD m1) (toStreamD m2
26832687--
26842688-- Do not use at scale in concatMapWith.
26852689--
2686−-- @since 0.7.0
2690+-- /Internal/
26872691{-# INLINE roundrobin #-}
26882692roundrobin ::(IsStream t, Monad m) => t m b -> t m b -> t m b
26892693roundrobin m1 m2 = fromStreamD $ D.roundRobin (toStreamD m1) (toStreamD m2)
@@ -2719,7 +2723,7 @@ concatUnfold u m = fromStreamD $ D.concatMapU u (toStreamD m)
27192723-- | Like 'concatUnfold' but interleaves the streams in the same way as
27202724-- 'interleave' behaves instead of appending them.
27212725--
2722−-- @since 0.7.0
2726+-- /Internal/
27232727{-# INLINE concatUnfoldInterleave #-}
27242728concatUnfoldInterleave ::(IsStream t, Monad m)
27252729 => Unfold m a b -> t m a -> t m b
@@ -2729,7 +2733,7 @@ concatUnfoldInterleave u m =
27292733-- | Like 'concatUnfold' but executes the streams in the same way as
27302734-- 'roundrobin'.
27312735--
2732−-- @since 0.7.0
2736+-- /Internal/
27332737{-# INLINE concatUnfoldRoundrobin #-}
27342738concatUnfoldRoundrobin ::(IsStream t, Monad m)
27352739 => Unfold m a b -> t m a -> t m b
@@ -2772,6 +2776,7 @@ gintercalate unf1 str1 unf2 str2 =
27722776-- >>> intercalate " " UF.fromList ["abc", "def", "ghi"]
27732777-- > "abc def ghi"
27742778--
2779+-- /Internal/
27752780{-# INLINE intercalate #-}
27762781intercalate :: (IsStream t, Monad m)
27772782 => b -> Unfold m b c -> t m b -> t m c
@@ -2814,6 +2819,7 @@ gintercalateSuffix unf1 str1 unf2 str2 =
28142819-- >>> intercalate "\n" UF.fromList ["abc", "def", "ghi"]
28152820-- > "abc\ndef\nghi\n"
28162821--
2822+-- /Internal/
28172823{-# INLINE intercalateSuffix #-}
28182824intercalateSuffix :: (IsStream t, Monad m)
28192825 => b -> Unfold m b c -> t m b -> t m c
@@ -3000,7 +3006,7 @@ concatMapTreeYieldLeavesWith combine f = concatMapLoopWith combine f yield
30003006-- >>> splitAt_ 4 [1,2,3]
30013007-- > ([1,2,3],[])
30023008--
3003−-- @since 0.7.0
3009+-- /Internal/
30043010
30053011-- This can be considered as a two-fold version of 'ltake' where we take both
30063012-- the segments instead of discarding the leftover.
@@ -3083,6 +3089,9 @@ chunksOf
30833089 => Int -> Fold m a b -> t m a -> t m b
30843090chunksOf n f m = D.fromStreamD $ D.groupsOf n f (D.toStreamD m)
30853091
3092+-- |
3093+--
3094+-- /Internal/
30863095{-# INLINE chunksOf2 #-}
30873096chunksOf2
30883097 :: (IsStream t, Monad m)
@@ -3096,7 +3105,7 @@ chunksOf2 n action f m = D.fromStreamD $ D.groupsOf2 n action f (D.toStreamD m)
30963105--
30973106-- > arraysOf n = S.chunksOf n (A.writeN n)
30983107--
3099−-- @since 0.7.0
3108+-- /Internal/
31003109{-# INLINE arraysOf #-}
31013110arraysOf :: (IsStream t, MonadIO m, Storable a)
31023111 => Int -> t m a -> t m (Array a)
@@ -3131,6 +3140,8 @@ intervalsOf n f xs =
31313140-- long as the predicate applied to the first element of the stream and next
31323141-- input element holds 'True', the second group takes the rest of the input.
31333142--
3143+-- /Internal/
3144+--
31343145spanBy
31353146 :: Monad m
31363147 => (a -> a -> Bool)
@@ -3174,7 +3185,7 @@ spanBy cmp (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
31743185-- >>> span_ (< 4) [1,2,3]
31753186-- > ([1,2,3],[])
31763187--
3177−-- @since 0.7.0
3188+-- /Internal/
31783189
31793190-- This can be considered as a two-fold version of 'ltakeWhile' where we take
31803191-- both the segments instead of discarding the leftover.
@@ -3219,7 +3230,7 @@ span p (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
32193230-- >>> break_ (< 4) [3,2,1]
32203231-- > ([],[3,2,1])
32213232--
3222−-- @since 0.7.0
3233+-- /Internal/
32233234{-# INLINE break #-}
32243235break
32253236 :: Monad m
@@ -3231,6 +3242,8 @@ break p = span (not . p)
32313242
32323243-- | Like 'spanBy' but applies the predicate in a rolling fashion i.e.
32333244-- predicate is applied to the previous and the next input elements.
3245+--
3246+-- /Internal/
32343247{-# INLINE spanByRolling #-}
32353248spanByRolling
32363249 :: Monad m
@@ -3589,7 +3602,7 @@ splitWithSuffix predicate f m =
35893602--
35903603-- > splitOn . intercalate == id
35913604--
3592−-- @since 0.7.0
3605+-- /Internal/
35933606
35943607-- XXX We can use a polymorphic vector implemented by Array# to represent the
35953608-- sequence, that way we can avoid the Storable constraint. If we still need
@@ -3643,7 +3656,7 @@ splitOnAny subseq f m = undefined -- D.fromStreamD $ D.splitOnAny f subseq (D.to
36433656--
36443657-- > lines = splitSuffixOn "\n"
36453658--
3646−-- @since 0.7.0
3659+-- /Internal/
36473660{-# INLINE splitOnSuffixSeq #-}
36483661splitOnSuffixSeq
36493662 :: (IsStream t, MonadIO m, Storable a, Enum a, Eq a)
@@ -3694,7 +3707,7 @@ wordsOn subseq f m = undefined -- D.fromStreamD $ D.wordsOn f subseq (D.toStream
36943707-- >>> splitOn'_ "ll" "hello"
36953708-- > ["he","ll","o"]
36963709--
3697−-- @since 0.7.0
3710+-- /Internal/
36983711{-# INLINE splitBySeq #-}
36993712splitBySeq
37003713 :: (IsStream t, MonadAsync m, Storable a, Enum a, Eq a)
@@ -3730,7 +3743,7 @@ splitBySeq patt f m =
37303743-- >>> splitSuffixOn'_ "." "a..b.."
37313744-- > ["a.",".","b.","."]
37323745--
3733−-- @since 0.7.0
3746+-- /Internal/
37343747{-# INLINE splitWithSuffixSeq #-}
37353748splitWithSuffixSeq
37363749 :: (IsStream t, MonadIO m, Storable a, Enum a, Eq a)
@@ -3763,7 +3776,7 @@ splitSuffixOnAny subseq f m = undefined
37633776-- CAUTION! This is not a true streaming function as the container size after
37643777-- the split and merge may not be bounded.
37653778--
3766−-- @since 0.7.0
3779+-- /Internal/
37673780{-# INLINE splitInnerBy #-}
37683781splitInnerBy
37693782 :: (IsStream t, Monad m)
@@ -3777,7 +3790,7 @@ splitInnerBy splitter joiner xs =
37773790-- | Like 'splitInnerBy' but splits assuming the separator joins the segment in
37783791-- a suffix style.
37793792--
3780−-- @since 0.7.0
3793+-- /Internal/
37813794{-# INLINE splitInnerBySuffix #-}
37823795splitInnerBySuffix
37833796 :: (IsStream t, Monad m, Eq (f a), Monoid (f a))
@@ -3898,7 +3911,7 @@ tapAsync f xs = D.fromStreamD $ D.tapAsync f (D.toStreamD xs)
38983911--
38993912-- Note: This may not work correctly on 32-bit machines.
39003913--
3901−-- /Internal
3914+-- /Internal/
39023915--
39033916{-# INLINE pollCounts #-}
39043917pollCounts ::
@@ -3929,7 +3942,7 @@ pollCounts predicate transf f xs =
39293942--
39303943-- Note: This may not work correctly on 32-bit machines.
39313944--
3932−-- /Internal
3945+-- /Internal/
39333946{-# INLINE tapRate #-}
39343947tapRate ::
39353948 (IsStream t, MonadAsync m, MonadCatch m)