on master help sign in
Collect all internal Fold modules in one
commit5c890aee92dd2df2251d9a49fd2314ce906efcac authorHarendra Kumar <harendra@composewell.com> dateSun 26 Nov 2023, 14:02 (3 years ago) parent3f841aa
5 files changed+29−53
src/Streamly/Data/Fold/Prelude.hs+1−1 src/Streamly/Internal/Data/Fold/Concurrent.hs+1−44 src/Streamly/Internal/Data/Fold/Concurrent/Channel.hs+1−3 src/Streamly/Internal/Data/Fold/Prelude.hs+19 streamly.cabal+7−5
src/Streamly/Data/Fold/Prelude.hs+1−1
@@ -55,7 +55,7 @@ import Streamly.Internal.Data.IsMap.HashMap ()
5555--
5656-- >>> classify = Fold.toHashMapIO fst (Fold.lmap snd Fold.toList)
5757-- >>> Stream.fold classify input :: IO (HashMap String [Double])
58−-- fromList [("k1",[1.0,1.1]),("k2",[2.0,2.2])]
58+-- fromList [("k2",[2.0,2.2]),("k1",[1.0,1.1])]
5959--
6060-- /Pre-release/
6161--
src/Streamly/Internal/Data/Fold/Concurrent.hs+1−44
@@ -50,51 +50,8 @@
5050
5151module Streamly.Internal.Data.Fold.Concurrent
5252 (
53− -- * Configuration
54− Config
55− , maxBuffer
56− , boundThreads
57− , inspect
58−
59− -- * Combinators
60− -- | Stream combinators using Async channel
61−
62− , parEval
53+ module Streamly.Internal.Data.Fold.Concurrent.Channel
6354 )
6455where
6556
66−-- import Streamly.Internal.Control.Concurrent (MonadAsync)
67−-- import Streamly.Internal.Data.Fold (Fold)
68−
6957import Streamly.Internal.Data.Fold.Concurrent.Channel
70−
71−-- $setup
72−--
73−-- Imports for example snippets in this module.
74−--
75−-- >>> :m
76−-- >>> :set -XFlexibleContexts
77−-- >>> import Control.Concurrent (threadDelay)
78−-- >>> import qualified Streamly.Data.Array as Array
79−-- >>> import qualified Streamly.Data.Fold as Fold
80−-- >>> import qualified Streamly.Data.Parser as Parser
81−-- >>> import qualified Streamly.Data.Stream as Stream
82−-- >>> import qualified Streamly.Internal.Data.Fold.Concurrent as Fold
83−-- >>> import Prelude hiding (concatMap, concat)
84−-- >>> :{
85−-- delay n = do
86−-- threadDelay (n * 1000000) -- sleep for n seconds
87−-- putStrLn (show n ++ " sec") -- print "n sec"
88−-- return n -- IO Int
89−-- :}
90−
91−{-
92−-- | Evaluate a stream asynchronously using a channel and serve the consumer
93−-- from the evaluation buffer.
94−--
95−-- >>> eval = Fold.parEval id
96−--
97−{-# INLINE eval #-}
98−eval :: MonadAsync m => Fold m a b -> Fold m a b
99−eval = parEval id
100−-}
src/Streamly/Internal/Data/Fold/Concurrent/Channel.hs+1−3
@@ -8,11 +8,9 @@
88
99module Streamly.Internal.Data.Fold.Concurrent.Channel
1010 (
11− -- * Channel
12− Channel
11+ module Streamly.Internal.Data.Fold.Concurrent.Channel.Type
1312
1413 -- * Configuration
15− , Config
1614 , maxBuffer
1715 , boundThreads
1816 , inspect
src/Streamly/Internal/Data/Fold/Prelude.hsnew file+19
@@ -0,0 +1,19 @@
1+-- |
2+-- Module : Streamly.Internal.Data.Fold.Prelude
3+-- Copyright : (c) 2022 Composewell Technologies
4+-- License : BSD-3-Clause
5+-- Maintainer : streamly@composewell.com
6+-- Stability : experimental
7+-- Portability : GHC
8+--
9+module Streamly.Internal.Data.Fold.Prelude
10+ (
11+ module Streamly.Internal.Data.Fold.Async
12+ , module Streamly.Internal.Data.Fold.Concurrent
13+ , module Streamly.Internal.Data.Fold.SVar
14+ )
15+where
16+
17+import Streamly.Internal.Data.Fold.Async
18+import Streamly.Internal.Data.Fold.Concurrent
19+import Streamly.Internal.Data.Fold.SVar
streamly.cabal+7−5
@@ -375,9 +375,7 @@ library
375375 , Streamly.Internal.Data.Stream.Channel.Worker
376376
377377 , Streamly.Internal.Data.Unfold.Exception
378− , Streamly.Internal.Data.Fold.Concurrent.Channel.Type
379− , Streamly.Internal.Data.Fold.Concurrent.Channel
380− , Streamly.Internal.Data.Fold.Concurrent
378+ , Streamly.Internal.Data.Fold.Prelude
381379
382380 , Streamly.Internal.Data.Stream.Concurrent.Channel.Type
383381 , Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
@@ -417,8 +415,6 @@ library
417415 , Streamly.Internal.Data.SVar
418416
419417 , Streamly.Internal.Data.Unfold.SVar
420− , Streamly.Internal.Data.Fold.SVar
421− , Streamly.Internal.Data.Fold.Async
422418 , Streamly.Internal.Data.Stream.SVar.Generate
423419 , Streamly.Internal.Data.Stream.SVar.Eliminate
424420
@@ -465,6 +461,12 @@ library
465461 , Streamly.Data.Stream.Concurrent
466462 , Streamly.Data.Stream.Time
467463
464+ , Streamly.Internal.Data.Fold.SVar
465+ , Streamly.Internal.Data.Fold.Async
466+ , Streamly.Internal.Data.Fold.Concurrent.Channel.Type
467+ , Streamly.Internal.Data.Fold.Concurrent.Channel
468+ , Streamly.Internal.Data.Fold.Concurrent
469+
468470 , Streamly.Internal.Data.Stream.Common
469471 , Streamly.Internal.Data.Stream.IsStream.Type
470472 , Streamly.Internal.Data.Stream.IsStream.Generate