on master help sign in
Re-export entire submodules from Producer (#2514)
commite6051b17cc883ae74c009e5239a6248b924eb122 authorRanjeet Ranjan <ranjeetr@composewell.com> dateFri 11 Aug 2023, 15:14 (3 years ago) parentc256c32
5 files changed+16−25
benchmark/Streamly/Benchmark/Data/Parser.hs+3−4 core/src/Streamly/Internal/Data/Producer.hs+4−11 core/streamly-core.cabal+3−2 test/Streamly/Test/Data/Parser.hs+3−4 test/Streamly/Test/Data/ParserK.hs+3−4
benchmark/Streamly/Benchmark/Data/Parser.hs+3−4
@@ -47,7 +47,6 @@ import qualified Streamly.Internal.Data.Fold as Fold
4747import qualified Streamly.Internal.Data.Parser as PR
4848import qualified Streamly.Data.Stream as Stream
4949import qualified Streamly.Internal.Data.Producer as Producer
50−import qualified Streamly.Internal.Data.Producer.Source as Source
5150import qualified Streamly.Internal.Data.Stream as Stream
5251
5352import Gauge hiding (env)
@@ -635,13 +634,13 @@ choice value =
635634{-# INLINE parseManyUnfoldArrays #-}
636635parseManyUnfoldArrays :: Int -> [Array.Array Int] -> IO ()
637636parseManyUnfoldArrays count arrays = do
638− let src = Source.source (Just (Producer.OuterLoop arrays))
637+ let src = Producer.source (Just (Producer.OuterLoop arrays))
639638 let parser = PR.fromFold (Fold.take count Fold.drain)
640639 let readSrc =
641− Source.producer
640+ Producer.producer
642641 $ Producer.concat Producer.fromList Array.producer
643642 let streamParser =
644− Producer.simplify (Source.parseMany parser readSrc)
643+ Producer.simplify (Producer.parseMany parser readSrc)
645644 Stream.fold Fold.drain $ Stream.unfold streamParser src
646645
647646-------------------------------------------------------------------------------
core/src/Streamly/Internal/Data/Producer.hs+4−11
@@ -24,21 +24,13 @@
2424-- unecessary function calls can be avoided.
2525
2626module Streamly.Internal.Data.Producer
27− ( Producer (..)
27+ (
28+ module Streamly.Internal.Data.Producer.Source
29+ , module Streamly.Internal.Data.Producer.Type
2830
2931 -- * Converting
3032 , simplify
31−
32− -- * Producers
33− , nil
34− , nilM
35− , unfoldrM
3633 , fromStreamD
37− , fromList
38−
39− -- * Combinators
40− , NestedLoop (..)
41− , concat
4234 )
4335where
4436
@@ -49,6 +41,7 @@ import Streamly.Internal.Data.Stream.StreamD.Type (Stream(..))
4941import Streamly.Internal.Data.SVar.Type (defState)
5042import Streamly.Internal.Data.Unfold.Type (Unfold(..))
5143
44+import Streamly.Internal.Data.Producer.Source
5245import Streamly.Internal.Data.Producer.Type
5346import Prelude hiding (concat)
5447
core/streamly-core.cabal+3−2
@@ -291,9 +291,7 @@ library
291291 -- streamly-core-stream-types
292292 , Streamly.Internal.Data.SVar.Type
293293 , Streamly.Internal.Data.Refold.Type
294− , Streamly.Internal.Data.Producer.Type
295294 , Streamly.Internal.Data.Producer
296− , Streamly.Internal.Data.Producer.Source
297295 , Streamly.Internal.Data.Parser.ParserK.Type
298296 , Streamly.Internal.Data.Parser.ParserD.Type
299297 , Streamly.Internal.Data.Pipe.Type
@@ -432,6 +430,9 @@ library
432430
433431 , Streamly.Internal.Data.Array.Type
434432
433+ , Streamly.Internal.Data.Producer.Type
434+ , Streamly.Internal.Data.Producer.Source
435+
435436 if flag(dev)
436437 other-modules:
437438 Streamly.Internal.Data.Stream.StreamK.Alt
test/Streamly/Test/Data/Parser.hs+3−4
@@ -21,7 +21,6 @@ import qualified Streamly.Data.Stream as S
2121import qualified Streamly.Internal.Data.Array as A
2222import qualified Streamly.Internal.Data.Fold as FL
2323import qualified Streamly.Internal.Data.Parser as P
24−import qualified Streamly.Internal.Data.Producer.Source as Source
2524import qualified Streamly.Internal.Data.Producer as Producer
2625import qualified Streamly.Internal.Data.Unfold as Unfold
2726import qualified Test.Hspec as H
@@ -850,13 +849,13 @@ parseUnfold = do
850849 <*> chooseInt (1, len)) $ \(ls, clen, tlen) ->
851850 monadicIO $ do
852851 arrays <- S.toList $ S.chunksOf clen (S.fromList ls)
853− let src = Source.source (Just (Producer.OuterLoop arrays))
852+ let src = Producer.source (Just (Producer.OuterLoop arrays))
854853 let parser = P.fromFold (FL.take tlen FL.toList)
855854 let readSrc =
856− Source.producer
855+ Producer.producer
857856 $ Producer.concat Producer.fromList A.producer
858857 let streamParser =
859− Producer.simplify (Source.parseManyD parser readSrc)
858+ Producer.simplify (Producer.parseManyD parser readSrc)
860859 xs <- run
861860 $ S.toList
862861 $ S.unfoldMany Unfold.fromList
test/Streamly/Test/Data/ParserK.hs+3−4
@@ -17,7 +17,6 @@ import qualified Streamly.Data.Stream as S
1717import qualified Streamly.Internal.Data.Array as A
1818import qualified Streamly.Internal.Data.Fold as FL
1919import qualified Streamly.Internal.Data.Parser as P
20−import qualified Streamly.Internal.Data.Producer.Source as Source
2120import qualified Streamly.Internal.Data.Producer as Producer
2221import qualified Streamly.Internal.Data.Stream as S
2322import qualified Streamly.Internal.Data.Stream as D
@@ -660,13 +659,13 @@ parseUnfold = do
660659 <*> chooseInt (1, len)) $ \(ls, clen, tlen) ->
661660 monadicIO $ do
662661 arrays <- toList $ S.chunksOf clen (S.fromList ls)
663− let src = Source.source (Just (Producer.OuterLoop arrays))
662+ let src = Producer.source (Just (Producer.OuterLoop arrays))
664663 let parser = P.fromFold (FL.take tlen FL.toList)
665664 let readSrc =
666− Source.producer
665+ Producer.producer
667666 $ Producer.concat Producer.fromList A.producer
668667 let streamParser =
669− Producer.simplify (Source.parseManyD parser readSrc)
668+ Producer.simplify (Producer.parseManyD parser readSrc)
670669 xs <- run
671670 $ toList
672671 $ S.unfoldMany Unfold.fromList