APIs ---- Removed: merge lazy left scans: scanl, scanlM, scanl1, scanl1M Renamed: generate and generateM renamed to fromIndices and fromIndicesM Added: replicate mergeByM, mergeAsyncBy, mergeAsyncByM `intFrom`, `intFromTo`, `intFromThen`, `intFromThenTo`, `intFromStep`, `fracFrom`, `fracFromThen`, `fracFromThenTo`, `numFromStep` Added StreamD version of replicateM and a rewrite rule for replicateMSerial. Added but not exposed: postscanl and prescanl ops Rewrote mergeByS in StreamK, simplified quite a bit and got some perf improvement too. Added @since notations to new APIs. Fixed lines exceeding 80 columns. Tests ----- Added tests for the new enumeration APIs. Improved some tests by generating values randomly using quickcheck forAll. We can improve more tests similarly. Removed some redundant transformOps tests. reorganized test code in groups so as to keep similar functionality together and added header lines so that we can find relevant code easily. Benchmarks ---------- Added benchmarks for enumeration primitives added above. Added benchmarks for scan and fold mixed ops. Added benchmark for concatMap. Fixed foldr and foldrM benchmarks to use a (+) operation instead of a list operation for fair comparision with other folds. Kept only one benchmark each for deleteBy, insertBy, isPrefixOf and isSubsequenceOf. Documentation ------------- Updated documentation, added examples for the new primitives as well as many old ones. Especially the documentation of folds and scans was rewritten. Reordered and re-organized the groups of APIs in the doc. Refactoring ----------- Some related and urelated refactoring. Hlint ----- Fixed some hlint hints introduced recently. TBD --- Some APIs need concurrent versions. I have added "XXX" notes for those. Some more tests have to be added. Some more benchmarks have to be added.
8.8 KiB
Unreleased
Breaking changes
- 'Monad' constraint may be needed on some of the existing APIs.
Enhancements
- Add benchmarks to measure composed and iterated operations
- Performance improvements
- Add the following functions to Prelude:
- Generation:
replicate
,fromIndices
,fromIndicesM
- Enumeration:
intFrom
,intFromTo
,intFromThen
,intFromThenTo
,intFromStep
,fracFrom
,fracFromThen
,fracFromThenTo
,numFromStep
- Folds:
(!!)
,maximumBy
,minimumBy
,the
- Scans:
scanl1'
, `scanl1M' - Filters:
uniq
,insertBy
,deleteBy
,findM
- Multi-stream:
eqBy
,cmpBy
,mergeBy
,mergeByM
,mergeAsyncBy
,mergeAsyncByM
,isPrefixOf
,isSubsequenceOf
,stripPrefix
,concatMap
,concatMapM
,indexed
,indexedR
- Generation:
0.5.2
Bug Fixes
- Cleanup any pending threads when an exception occurs.
- Fixed a livelock in ahead style streams. The problem manifests sometimes when multiple streams are merged together in ahead style and one of them is a nil stream.
- As per expected concurrency semantics each forked concurrent task must run
with the monadic state captured at the fork point. This release fixes a bug,
which, in some cases caused an incorrect monadic state to be used for a
concurrent action, leading to unexpected behavior when concurrent streams are
used in a stateful monad e.g.
StateT
. Particularly, this bug cannot affectReaderT
.
0.5.1
- Performance improvements, especially space consumption, for concurrent streams
0.5.0
Bug Fixes
- Leftover threads are now cleaned up as soon as the consumer is garbage collected.
- Fix a bug in concurrent function application that in certain cases would unnecessarily share the concurrency state resulting in incorrect output stream.
- Fix passing of state across
parallel
,async
,wAsync
,ahead
,serial
,wSerial
combinators. Without this fix combinators that rely on state passing e.g.maxThreads
andmaxBuffer
won't work across these combinators.
Enhancements
- Added rate limiting combinators
rate
,avgRate
,minRate
,maxRate
andconstRate
to control the yield rate of a stream. - Add
foldl1'
,foldr1
,intersperseM
,find
,lookup
,and
,or
,findIndices
,findIndex
,elemIndices
,elemIndex
,init
to Prelude
Deprecations
- The
Streamly.Time
module is now deprecated, its functionality is subsumed by the new rate limiting combinators.
0.4.1
Bug Fixes
- foldxM was not fully strict, fixed.
0.4.0
Breaking changes
- Signatures of
zipWithM
andzipAsyncWithM
have changed - Some functions in prelude now require an additional
Monad
constraint on the underlying type of the stream.
Deprecations
once
has been deprecated and renamed toyieldM
Enhancements
- Add concurrency control primitives
maxThreads
andmaxBuffer
. - Concurrency of a stream with bounded concurrency when used with
take
is now limited by the number of elements demanded bytake
. - Significant performance improvements utilizing stream fusion optimizations.
- Add
yield
to construct a singleton stream from a pure value - Add
repeat
to generate an infinite stream by repeating a pure value - Add
fromList
andfromListM
to generate streams from lists, faster thanfromFoldable
andfromFoldableM
- Add
map
as a synonym of fmap - Add
scanlM'
, the monadic version of scanl' - Add
takeWhileM
anddropWhileM
- Add
filterM
0.3.0
Breaking changes
- Some prelude functions, to whom concurrency capability has been added, will
now require a
MonadAsync
constraint.
Bug Fixes
- Fixed a race due to which, in a rare case, we might block indefinitely on an MVar due to a lost wakeup.
- Fixed an issue in adaptive concurrency. The issue caused us to stop creating more worker threads in some cases due to a race. This bug would not cause any functional issue but may reduce concurrency in some cases.
Enhancements
- Added a concurrent lookahead stream type
Ahead
- Added
fromFoldableM
API that creates a stream from a container of monadic actions - Monadic stream generation functions
consM
,|:
,unfoldrM
,replicateM
,repeatM
,iterateM
andfromFoldableM
can now generate streams concurrently when used with concurrent stream types. - Monad transformation functions
mapM
andsequence
can now map actions concurrently when used at appropriate stream types. - Added concurrent function application operators to run stages of a stream processing function application pipeline concurrently.
- Added
mapMaybe
andmapMaybeM
.
0.2.1
Bug Fixes
- Fixed a bug that caused some transformation ops to return incorrect results
when used with concurrent streams. The affected ops are
take
,filter
,takeWhile
,drop
,dropWhile
, andreverse
.
0.2.0
Breaking changes
-
Changed the semantics of the Semigroup instance for
InterleavedT
,AsyncT
andParallelT
. The new semantics are as follows:- For
InterleavedT
,<>
operation interleaves two streams - For
AsyncT
,<>
now concurrently merges two streams in a left biased manner using demand based concurrency. - For
ParallelT
, the<>
operation now concurrently meges the two streams in a fairly parallel manner.
To adapt to the new changes, replace
<>
withserial
wherever it is used for stream types other thanStreamT
. - For
-
Remove the
Alternative
instance. To adapt to this change replace any usage of<|>
withparallel
andempty
withnil
. -
Stream type now defaults to the
SerialT
type unless explicitly specified using a type combinator or a monomorphic type. This change reduces puzzling type errors for beginners. It includes the following two changes:- Change the type of all stream elimination functions to use
SerialT
instead of a polymorphic type. This makes sure that the stream type is always fixed at all exits. - Change the type combinators (e.g.
parallely
) to only fix the argument stream type and the output stream type remains polymorphic.
Stream types may have to be changed or type combinators may have to be added or removed to adapt to this change.
- Change the type of all stream elimination functions to use
-
Change the type of
foldrM
to make it consistent withfoldrM
in base. -
async
is renamed tomkAsync
andasync
is now a new API with a different meaning. -
ZipAsync
is renamed toZipAsyncM
andZipAsync
is now ZipAsyncM specialized to the IO Monad. -
Remove the
MonadError
instance as it was not working correctly for parallel compositions. UseMonadThrow
instead for error propagation. -
Remove Num/Fractional/Floating instances as they are not very useful. Use
fmap
andliftA2
instead.
Deprecations
- Deprecate and rename the following symbols:
Streaming
toIsStream
runStreaming
torunStream
StreamT
toSerialT
InterleavedT
toWSerialT
ZipStream
toZipSerialM
ZipAsync
toZipAsyncM
interleaving
towSerially
zipping
tozipSerially
zippingAsync
tozipAsyncly
<=>
towSerial
<|
toasync
each
tofromFoldable
scan
toscanx
foldl
tofoldx
foldlM
tofoldxM
- Deprecate the following symbols for future removal:
runStreamT
runInterleavedT
runAsyncT
runParallelT
runZipStream
runZipAsync
Enhancements
- Add the following functions:
consM
and|:
operator to construct streams from monadic actionsonce
to create a singleton stream from a monadic actionrepeatM
to construct a stream by repeating a monadic actionscanl'
strict left scanfoldl'
strict left foldfoldlM'
strict left fold with a monadic fold functionserial
run two streams serially one after the otherasync
run two streams asynchronouslyparallel
run two streams in parallel (replaces<|>
)WAsyncT
stream type for BFS version ofAsyncT
composition
- Add simpler stream types that are specialized to the IO monad
- Put a bound (1500) on the output buffer used for asynchronous tasks
- Put a limit (1500) on the number of threads used for Async and WAsync types
0.1.2
Enhancements
- Add
iterate
,iterateM
stream operations
Bug Fixes
- Fixed a bug that casued unexpected behavior when
pure
was used to inject values in Applicative composition ofZipStream
andZipAsync
types.
0.1.1
Enhancements
- Make
cons
right associative and provide an operator form.:
for it - Add
null
,tail
,reverse
,replicateM
,scan
stream operations - Improve performance of some stream operations (
foldl
,dropWhile
)
Bug Fixes
- Fix the
product
operation. Earlier, it always returned 0 due to a bug - Fix the
last
operation, which returnedNothing
for singleton streams
0.1.0
- Initial release