on master help sign in
Export entire sub-modules in StreamD
commit515e76e3cd6d560390ef8b203c0b1a763528e6d1 authorHarendra Kumar <harendra@composewell.com> dateWed 20 Jan 2021, 18:45 (6 years ago) parenta0d3f83
1 file changed+11−291
src/Streamly/Internal/Data/Stream/StreamD.hs+11−291
src/Streamly/Internal/Data/Stream/StreamD.hs+11−291
@@ -1,5 +1,3 @@
1−#include "inline.hs"
2−
31-- |
42-- Module : Streamly.Internal.Data.Stream.StreamD
53-- Copyright : (c) 2018 Composewell Technologies
@@ -8,305 +6,27 @@
86-- Stability : experimental
97-- Portability : GHC
108--
11−-- Direct style re-implementation of CPS style stream in StreamK module. The
12−-- symbol or suffix 'D' in this module denotes the "Direct" style. GHC is able
13−-- to INLINE and fuse direct style better, providing better performance than
14−-- CPS implementation.
9+-- Direct style re-implementation of CPS stream in
10+-- "Streamly.Internal.Data.Stream.StreamK". The symbol or suffix 'D' in this
11+-- module denotes the "Direct" style. GHC is able to INLINE and fuse direct
12+-- style better, providing better performance than CPS implementation.
1513--
1614-- @
1715-- import qualified Streamly.Internal.Data.Stream.StreamD as D
1816-- @
1917
20−-- Some of the functions in this file have been adapted from the vector
21−-- library, https://hackage.haskell.org/package/vector.
22−
2318module Streamly.Internal.Data.Stream.StreamD
2419 (
25− -- * The stream type
26− Step (..)
27− , Stream (Stream, UnStream)
28−
29− -- * Construction
30− , nil
31− , nilM
32− , cons
33−
34− -- * Deconstruction
35− , uncons
36−
37− -- * Generation
38− -- ** Unfolds
39− , unfoldr
40− , unfoldrM
41− , unfold
42−
43− -- ** Specialized Generation
44− -- | Generate a monadic stream from a seed.
45− , repeat
46− , repeatM
47− , replicate
48− , replicateM
49− , fromIndices
50− , fromIndicesM
51− , generate
52− , generateM
53− , iterate
54− , iterateM
55−
56− -- ** Enumerations
57− , enumerateFromStepIntegral
58− , enumerateFromIntegral
59− , enumerateFromThenIntegral
60− , enumerateFromToIntegral
61− , enumerateFromThenToIntegral
62−
63− , enumerateFromStepNum
64− , numFrom
65− , numFromThen
66− , enumerateFromToFractional
67− , enumerateFromThenToFractional
68−
69− -- ** Time
70− , times
71−
72− -- ** Conversions
73− -- | Transform an input structure into a stream.
74− -- | Direct style stream does not support @fromFoldable@.
75− , yield
76− , yieldM
77− , fromList
78− , fromListM
79− , fromStreamK
80− , fromStreamD
81− , fromPrimIORef
82− , fromSVar
83−
84− -- * Elimination
85− -- ** General Folds
86− , foldrS
87− , foldrT
88− , foldrM
89− , foldrMx
90− , foldr
91− , foldr1
92−
93− , foldl'
94− , foldlM'
95− , foldlS
96− , foldlT
97− , reverse
98− , reverse'
99−
100− , foldlx'
101− , foldlMx'
102− , foldOnce
103− , foldMany
104− , foldMany1
105−
106− , parselMx'
107− , parseMany
108− , parseIterate
109−
110− -- ** Specialized Folds
111− , tap
112− , tapOffsetEvery
113− , tapAsync
114− , tapRate
115− , pollCounts
116− , drain
117− , null
118− , head
119− , headElse
120− , tail
121− , last
122− , elem
123− , notElem
124− , all
125− , any
126− , maximum
127− , maximumBy
128− , minimum
129− , minimumBy
130− , findIndices
131− , lookup
132− , findM
133− , find
134− , (!!)
135− , toSVarParallel
136−
137− -- ** Flattening nested streams
138− , concatMapM
139− , concatMap
140− , ConcatMapUState (..)
141− , concatMapU
142− , ConcatUnfoldInterleaveState (..)
143− , concatUnfoldInterleave
144− , concatUnfoldRoundrobin
145− , AppendState(..)
146− , append
147− , InterleaveState(..)
148− , interleave
149− , interleaveMin
150− , interleaveSuffix
151− , interleaveInfix
152− , roundRobin -- interleaveFair?/ParallelFair
153− , gintercalateSuffix
154− , interposeSuffix
155− , gintercalate
156− , interpose
157−
158− -- ** Grouping
159− , groupsOf2
160− , groupsBy
161− , groupsRollingBy
162−
163− -- ** Splitting
164− , wordsBy
165−
166− , splitOnSeq
167− , splitOnSuffixSeq
168−
169− , splitInnerBy
170− , splitInnerBySuffix
171−
172− -- ** Substreams
173− , isPrefixOf
174− , isSubsequenceOf
175− , stripPrefix
176−
177− -- ** Map and Fold
178− , mapM_
179−
180− -- ** Conversions
181− -- | Transform a stream into another type.
182− , toList
183− , toListRev
184− , toStreamK
185− , toStreamD
186−
187− , hoist
188− , generally
189−
190− , liftInner
191− , runReaderT
192− , evalStateT
193− , runStateT
194−
195− -- * Transformation
196− , transform
197−
198− -- ** By folding (scans)
199− , scanlM'
200− , scanlMAfter'
201− , scanl'
202− , scanlM
203− , scanl
204− , scanl1M'
205− , scanl1'
206− , scanl1M
207− , scanl1
208−
209− , prescanl'
210− , prescanlM'
211−
212− , postscanl
213− , postscanlM
214− , postscanl'
215− , postscanlM'
216− , postscanlMAfter'
217−
218− , postscanlx'
219− , postscanlMx'
220− , scanlMx'
221− , scanlx'
222− , postscanOnce
223− , scanOnce
224−
225− -- * Filtering
226− , filter
227− , filterM
228− , uniq
229− , take
230− , takeByTime
231− , takeWhile
232− , takeWhileM
233− , drop
234− , dropByTime
235− , dropWhile
236− , dropWhileM
237−
238− -- * Mapping
239− , map
240− , mapM
241− , sequence
242− , rollingMap
243− , rollingMapM
244−
245− -- * Inserting
246− , intersperseM
247− , intersperseM_
248− , intersperse
249− , intersperseSuffix
250− , intersperseSuffix_
251− , intersperseSuffixBySpan
252− , insertBy
253−
254− -- * Deleting
255− , deleteBy
256−
257− -- ** Map and Filter
258− , mapMaybe
259− , mapMaybeM
260−
261− -- * Zipping
262− , indexed
263− , indexedR
264− , zipWith
265− , zipWithM
266−
267− -- * Comparisons
268− , eqBy
269− , cmpBy
270−
271− -- * Merging
272− , mergeBy
273− , mergeByM
274−
275− -- * Transformation comprehensions
276− , the
277−
278− -- * Exceptions
279− , newFinalizedIORef
280− , runIORefFinalizer
281− , withIORefFinalizer
282− , gbracket_
283− , gbracket
284− , before
285− , after_
286− , after
287− , bracket_
288− , bracket
289− , onException
290− , finally_
291− , finally
292− , ghandle
293− , handle
294−
295− -- * Concurrent Application
296− , mkParallel
297− , mkParallelD
298− , newCallbackStream
20+ module Streamly.Internal.Data.Stream.StreamD.Type
21+ , module Streamly.Internal.Data.Stream.StreamD.Generate
22+ , module Streamly.Internal.Data.Stream.StreamD.Eliminate
23+ , module Streamly.Internal.Data.Stream.StreamD.Exception
24+ , module Streamly.Internal.Data.Stream.StreamD.Lift
25+ , module Streamly.Internal.Data.Stream.StreamD.Nesting
26+ , module Streamly.Internal.Data.Stream.StreamD.Transform
29927 )
30028where
30129
302−import Prelude hiding
303− ( map, mapM, mapM_, repeat, foldr, last, take, filter
304− , takeWhile, drop, dropWhile, all, any, maximum, minimum, elem
305− , notElem, null, head, tail, zipWith, lookup, foldr1, sequence
306− , (!!), scanl, scanl1, concatMap, replicate, enumFromTo, concat
307− , reverse, iterate, splitAt)
308−
309−-- XXX We could just export these modules directly
31030import Streamly.Internal.Data.Stream.StreamD.Type
31131import Streamly.Internal.Data.Stream.StreamD.Generate
31232import Streamly.Internal.Data.Stream.StreamD.Eliminate