Re-export entire submodules from Producer (#2514)

This commit is contained in:
Ranjeet Ranjan 2023-08-11 15:14:25 +05:30 committed by GitHub
parent c256c3223e
commit e6051b17cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 25 deletions

View File

@ -47,7 +47,6 @@ import qualified Streamly.Internal.Data.Fold as Fold
import qualified Streamly.Internal.Data.Parser as PR
import qualified Streamly.Data.Stream as Stream
import qualified Streamly.Internal.Data.Producer as Producer
import qualified Streamly.Internal.Data.Producer.Source as Source
import qualified Streamly.Internal.Data.Stream as Stream
import Gauge hiding (env)
@ -635,13 +634,13 @@ choice value =
{-# INLINE parseManyUnfoldArrays #-}
parseManyUnfoldArrays :: Int -> [Array.Array Int] -> IO ()
parseManyUnfoldArrays count arrays = do
let src = Source.source (Just (Producer.OuterLoop arrays))
let src = Producer.source (Just (Producer.OuterLoop arrays))
let parser = PR.fromFold (Fold.take count Fold.drain)
let readSrc =
Source.producer
Producer.producer
$ Producer.concat Producer.fromList Array.producer
let streamParser =
Producer.simplify (Source.parseMany parser readSrc)
Producer.simplify (Producer.parseMany parser readSrc)
Stream.fold Fold.drain $ Stream.unfold streamParser src
-------------------------------------------------------------------------------

View File

@ -24,21 +24,13 @@
-- unecessary function calls can be avoided.
module Streamly.Internal.Data.Producer
( Producer (..)
(
module Streamly.Internal.Data.Producer.Source
, module Streamly.Internal.Data.Producer.Type
-- * Converting
, simplify
-- * Producers
, nil
, nilM
, unfoldrM
, fromStreamD
, fromList
-- * Combinators
, NestedLoop (..)
, concat
)
where
@ -49,6 +41,7 @@ import Streamly.Internal.Data.Stream.StreamD.Type (Stream(..))
import Streamly.Internal.Data.SVar.Type (defState)
import Streamly.Internal.Data.Unfold.Type (Unfold(..))
import Streamly.Internal.Data.Producer.Source
import Streamly.Internal.Data.Producer.Type
import Prelude hiding (concat)

View File

@ -291,9 +291,7 @@ library
-- streamly-core-stream-types
, Streamly.Internal.Data.SVar.Type
, Streamly.Internal.Data.Refold.Type
, Streamly.Internal.Data.Producer.Type
, Streamly.Internal.Data.Producer
, Streamly.Internal.Data.Producer.Source
, Streamly.Internal.Data.Parser.ParserK.Type
, Streamly.Internal.Data.Parser.ParserD.Type
, Streamly.Internal.Data.Pipe.Type
@ -432,6 +430,9 @@ library
, Streamly.Internal.Data.Array.Type
, Streamly.Internal.Data.Producer.Type
, Streamly.Internal.Data.Producer.Source
if flag(dev)
other-modules:
Streamly.Internal.Data.Stream.StreamK.Alt

View File

@ -21,7 +21,6 @@ import qualified Streamly.Data.Stream as S
import qualified Streamly.Internal.Data.Array as A
import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as P
import qualified Streamly.Internal.Data.Producer.Source as Source
import qualified Streamly.Internal.Data.Producer as Producer
import qualified Streamly.Internal.Data.Unfold as Unfold
import qualified Test.Hspec as H
@ -850,13 +849,13 @@ parseUnfold = do
<*> chooseInt (1, len)) $ \(ls, clen, tlen) ->
monadicIO $ do
arrays <- S.toList $ S.chunksOf clen (S.fromList ls)
let src = Source.source (Just (Producer.OuterLoop arrays))
let src = Producer.source (Just (Producer.OuterLoop arrays))
let parser = P.fromFold (FL.take tlen FL.toList)
let readSrc =
Source.producer
Producer.producer
$ Producer.concat Producer.fromList A.producer
let streamParser =
Producer.simplify (Source.parseManyD parser readSrc)
Producer.simplify (Producer.parseManyD parser readSrc)
xs <- run
$ S.toList
$ S.unfoldMany Unfold.fromList

View File

@ -17,7 +17,6 @@ import qualified Streamly.Data.Stream as S
import qualified Streamly.Internal.Data.Array as A
import qualified Streamly.Internal.Data.Fold as FL
import qualified Streamly.Internal.Data.Parser as P
import qualified Streamly.Internal.Data.Producer.Source as Source
import qualified Streamly.Internal.Data.Producer as Producer
import qualified Streamly.Internal.Data.Stream as S
import qualified Streamly.Internal.Data.Stream as D
@ -660,13 +659,13 @@ parseUnfold = do
<*> chooseInt (1, len)) $ \(ls, clen, tlen) ->
monadicIO $ do
arrays <- toList $ S.chunksOf clen (S.fromList ls)
let src = Source.source (Just (Producer.OuterLoop arrays))
let src = Producer.source (Just (Producer.OuterLoop arrays))
let parser = P.fromFold (FL.take tlen FL.toList)
let readSrc =
Source.producer
Producer.producer
$ Producer.concat Producer.fromList A.producer
let streamParser =
Producer.simplify (Source.parseManyD parser readSrc)
Producer.simplify (Producer.parseManyD parser readSrc)
xs <- run
$ toList
$ S.unfoldMany Unfold.fromList