on 9183e21 help sign in
streamly/Changelog.md
364 lines 14 kB history raw
1## Unreleased
3### Breaking changes
5* Change the signature of `foldrM` to ensure that it is lazy
6* Change the signature of `iterateM` to ensure that it is lazy.
7* `scanx` would now require an additional `Monad m` constraint.
9### Behavior change
11* Earlier `ParallelT` was unaffected by `maxBuffer` directive, now `maxBuffer`
12 can limit the buffer of a `ParallelT` stream as well. When the buffer becomes
13 full, the producer threads block.
14* `ParallelT` streams no longer have an unlimited buffer by default. Now the
15 buffer for parallel streams is limited to 1500 by default, the same as other
16 concurrent stream types.
18### Deprecations
20* In `Streamly.Prelude`:
21 * `runStream` has been replaced by `drain`
22 * `runN` has been replaced by `drainN`
23 * `runWhile` has been replaced by `drainWhile`
24 * `fromHandle` has been deprecated. Please use
25 `Streamly.FileSystem.Handle.read`, `Streamly.Data.String.decodeUtf8` and
26 `Streamly.Data.String.lines` to split the stream into lines. Use
27 `Streamly.Data.String.foldLine` with `Streamly.Fold.toList` if you want to
28 convert the stream to a stream of `String`.
29 * `toHandle` has been deprecated. Please use `intersperse` and `concat` to
30 add newlines to a stream, `Streamly.Data.String.encodeUtf8` for encoding and
31 `Streamly.FileSystem.Handle.write` for writing to a file handle.
32 * Deprecate `scanx`, `foldx`, `foldxM`, `foldr1`
33 * Remove deprecated APIs `foldl`, `foldlM`
34 * Replace deprecated API `scan` with a new signature, to scan using Fold.
36* In `Streamly` module:
37 * `runStream` has been deprecated, please use `Streamly.Prelude.drain`
38 * `foldWith`, `foldMapWith`, `forEachWith` have been moved to
39 `Streamly.Prelude` module.
41* Remove deprecated module `Streamly.Time` (moved to Streamly.Internal)
43### Bug Fixes
45* Fix a bug that caused `uniq` function to yield the same element twice.
46* Fix a bug that caused "thread blocked indefinitely in an MVar operation"
47 exception in a parallel stream.
49### Major Enhancements
51This release contains a lot of new features and major enhancements. For more
52details on the new features described below please see the haddock docs of the
53modules on hackage.
55#### Exception Handling
57See `Streamly.Prelude` for new exception handling combinators like `before`,
58`after`, `bracket`, `onException`, `finally`, `handle` etc.
60#### Composable Folds
62`Streamly.Fold` module provides composable folds (stream consumers). Folds
63allow splitting, grouping, partitioning, unzipping and nesting a stream onto
64multiple folds without breaking the stream. Combinators are provided for
65temporal and spatial window based fold operations, for example, to support
66folding and aggregating data for timeout or inactivity based sessions.
68#### Composable Unfolds
70`Streamly.Unfold` module provides composable stream generators. Unfolds allow
71high performance merging/flattening/combining of stream generators.
73#### Streaming File IO
75`Streamly.FileSystem.Handle` provides handle based streaming file IO
76operations.
78#### Streaming Network IO
80`Streamly.Network.Socket` provides socket based streaming network IO
81operations.
83#### Concurrent concatMap
85The new `concatMapWith` combinator performs a `concatMap` using a supplied
86merge/concat strategy. This is a very powerful combinator as you can, for
87example, concat streams concurrently using this.
89### Other Enhancements
91* Add the following new features/modules:
92 * _Unicode Strings_: `Streamly.Data.String` module provides encoding/decoding of
93 character streams and other character stream operations.
94 * _Arrays_: `Streamly.Memory.Array` module provides arrays for efficient
95 in-memory buffering and efficient interfacing with IO.
97* Add the following to `Streamly.Prelude`:
98 * `unfold`, `fold`, `scan` and `postscan`
99 * `concatUnfold` to concat a stream after unfolding each element
100 * `intervalsOf` and `chunksOf`
101 * `splitOn`, `splitOnSuffix`, `splitWithSuffix`, and `wordsBy`
102 * `groups`, `groupsBy` and `groupsByRolling`
103 * `postscanl'` and `postscanlM'`
104 * `intersperse` intersperse an element in between consecutive elements in
105 stream
106 * `trace` combinator maps a monadic function on a stream just for side
107 effects
108 * `tap` redirects a copy of the stream to a `Fold`
110## 0.6.1
112### Bug Fixes
114* Fix a bug that caused `maxThreads` directive to be ignored when rate control
115 was not used.
117### Enhancements
119* Add GHCJS support
120* Remove dependency on "clock" package
122## 0.6.0
124### Breaking changes
126* `Monad` constraint may be needed on some of the existing APIs (`findIndices`
127 and `elemIndices`).
129### Enhancements
131* Add the following functions to Streamly.Prelude:
132 * Generation: `replicate`, `fromIndices`, `fromIndicesM`
133 * Enumeration: `Enumerable` type class, `enumerateFrom`, `enumerateFromTo`,
134 `enumerateFromThen`, `enumerateFromThenTo`, `enumerate`, `enumerateTo`
135 * Running: `runN`, `runWhile`
136 * Folds: `(!!)`, `maximumBy`, `minimumBy`, `the`
137 * Scans: `scanl1'`, `scanl1M'
138 * Filters: `uniq`, `insertBy`, `deleteBy`, `findM`
139 * Multi-stream: `eqBy`, `cmpBy`, `mergeBy`, `mergeByM`, `mergeAsyncBy`,
140 `mergeAsyncByM`, `isPrefixOf`, `isSubsequenceOf`, `stripPrefix`,
141 `concatMap`, `concatMapM`, `indexed`, `indexedR`
142* Following instances were added for `SerialT m`, `WSerialT m` and
143 `ZipSerialM m`:
144 * When `m` ~ `Identity`: IsList, Eq, Ord, Show, Read, IsString, NFData,
145 NFData1, Traversable
146 * When `m` is `Foldable`: Foldable
147* Performance improvements
148* Add benchmarks to measure composed and iterated operations
150## 0.5.2
152### Bug Fixes
154* Cleanup any pending threads when an exception occurs.
155* Fixed a livelock in ahead style streams. The problem manifests sometimes when
156 multiple streams are merged together in ahead style and one of them is a nil
157 stream.
158* As per expected concurrency semantics each forked concurrent task must run
159 with the monadic state captured at the fork point. This release fixes a bug,
160 which, in some cases caused an incorrect monadic state to be used for a
161 concurrent action, leading to unexpected behavior when concurrent streams are
162 used in a stateful monad e.g. `StateT`. Particularly, this bug cannot affect
163 `ReaderT`.
165## 0.5.1
167* Performance improvements, especially space consumption, for concurrent
168 streams
170## 0.5.0
172### Bug Fixes
174* Leftover threads are now cleaned up as soon as the consumer is garbage
175 collected.
176* Fix a bug in concurrent function application that in certain cases would
177 unnecessarily share the concurrency state resulting in incorrect output
178 stream.
179* Fix passing of state across `parallel`, `async`, `wAsync`, `ahead`, `serial`,
180 `wSerial` combinators. Without this fix combinators that rely on state
181 passing e.g. `maxThreads` and `maxBuffer` won't work across these
182 combinators.
184### Enhancements
186* Added rate limiting combinators `rate`, `avgRate`, `minRate`, `maxRate` and
187 `constRate` to control the yield rate of a stream.
188* Add `foldl1'`, `foldr1`, `intersperseM`, `find`, `lookup`, `and`, `or`,
189 `findIndices`, `findIndex`, `elemIndices`, `elemIndex`, `init` to Prelude
191### Deprecations
193* The `Streamly.Time` module is now deprecated, its functionality is subsumed
194 by the new rate limiting combinators.
196## 0.4.1
198### Bug Fixes
200* foldxM was not fully strict, fixed.
202## 0.4.0
204### Breaking changes
206* Signatures of `zipWithM` and `zipAsyncWithM` have changed
207* Some functions in prelude now require an additional `Monad` constraint on
208 the underlying type of the stream.
210### Deprecations
212* `once` has been deprecated and renamed to `yieldM`
214### Enhancements
216* Add concurrency control primitives `maxThreads` and `maxBuffer`.
217* Concurrency of a stream with bounded concurrency when used with `take` is now
218 limited by the number of elements demanded by `take`.
219* Significant performance improvements utilizing stream fusion optimizations.
220* Add `yield` to construct a singleton stream from a pure value
221* Add `repeat` to generate an infinite stream by repeating a pure value
222* Add `fromList` and `fromListM` to generate streams from lists, faster than
223 `fromFoldable` and `fromFoldableM`
224* Add `map` as a synonym of fmap
225* Add `scanlM'`, the monadic version of scanl'
226* Add `takeWhileM` and `dropWhileM`
227* Add `filterM`
229## 0.3.0
231### Breaking changes
233* Some prelude functions, to whom concurrency capability has been added, will
234 now require a `MonadAsync` constraint.
236### Bug Fixes
238* Fixed a race due to which, in a rare case, we might block indefinitely on
239 an MVar due to a lost wakeup.
240* Fixed an issue in adaptive concurrency. The issue caused us to stop creating
241 more worker threads in some cases due to a race. This bug would not cause any
242 functional issue but may reduce concurrency in some cases.
244### Enhancements
245* Added a concurrent lookahead stream type `Ahead`
246* Added `fromFoldableM` API that creates a stream from a container of monadic
247 actions
248* Monadic stream generation functions `consM`, `|:`, `unfoldrM`, `replicateM`,
249 `repeatM`, `iterateM` and `fromFoldableM` can now generate streams
250 concurrently when used with concurrent stream types.
251* Monad transformation functions `mapM` and `sequence` can now map actions
252 concurrently when used at appropriate stream types.
253* Added concurrent function application operators to run stages of a
254 stream processing function application pipeline concurrently.
255* Added `mapMaybe` and `mapMaybeM`.
257## 0.2.1
259### Bug Fixes
260* Fixed a bug that caused some transformation ops to return incorrect results
261 when used with concurrent streams. The affected ops are `take`, `filter`,
262 `takeWhile`, `drop`, `dropWhile`, and `reverse`.
264## 0.2.0
266### Breaking changes
267* Changed the semantics of the Semigroup instance for `InterleavedT`, `AsyncT`
268 and `ParallelT`. The new semantics are as follows:
269 * For `InterleavedT`, `<>` operation interleaves two streams
270 * For `AsyncT`, `<>` now concurrently merges two streams in a left biased
271 manner using demand based concurrency.
272 * For `ParallelT`, the `<>` operation now concurrently meges the two streams
273 in a fairly parallel manner.
275 To adapt to the new changes, replace `<>` with `serial` wherever it is used
276 for stream types other than `StreamT`.
278* Remove the `Alternative` instance. To adapt to this change replace any usage
279 of `<|>` with `parallel` and `empty` with `nil`.
280* Stream type now defaults to the `SerialT` type unless explicitly specified
281 using a type combinator or a monomorphic type. This change reduces puzzling
282 type errors for beginners. It includes the following two changes:
283 * Change the type of all stream elimination functions to use `SerialT`
284 instead of a polymorphic type. This makes sure that the stream type is
285 always fixed at all exits.
286 * Change the type combinators (e.g. `parallely`) to only fix the argument
287 stream type and the output stream type remains polymorphic.
289 Stream types may have to be changed or type combinators may have to be added
290 or removed to adapt to this change.
291* Change the type of `foldrM` to make it consistent with `foldrM` in base.
292* `async` is renamed to `mkAsync` and `async` is now a new API with a different
293 meaning.
294* `ZipAsync` is renamed to `ZipAsyncM` and `ZipAsync` is now ZipAsyncM
295 specialized to the IO Monad.
296* Remove the `MonadError` instance as it was not working correctly for
297 parallel compositions. Use `MonadThrow` instead for error propagation.
298* Remove Num/Fractional/Floating instances as they are not very useful. Use
299 `fmap` and `liftA2` instead.
301### Deprecations
302* Deprecate and rename the following symbols:
303 * `Streaming` to `IsStream`
304 * `runStreaming` to `runStream`
305 * `StreamT` to `SerialT`
306 * `InterleavedT` to `WSerialT`
307 * `ZipStream` to `ZipSerialM`
308 * `ZipAsync` to `ZipAsyncM`
309 * `interleaving` to `wSerially`
310 * `zipping` to `zipSerially`
311 * `zippingAsync` to `zipAsyncly`
312 * `<=>` to `wSerial`
313 * `<|` to `async`
314 * `each` to `fromFoldable`
315 * `scan` to `scanx`
316 * `foldl` to `foldx`
317 * `foldlM` to `foldxM`
318* Deprecate the following symbols for future removal:
319 * `runStreamT`
320 * `runInterleavedT`
321 * `runAsyncT`
322 * `runParallelT`
323 * `runZipStream`
324 * `runZipAsync`
326### Enhancements
327* Add the following functions:
328 * `consM` and `|:` operator to construct streams from monadic actions
329 * `once` to create a singleton stream from a monadic action
330 * `repeatM` to construct a stream by repeating a monadic action
331 * `scanl'` strict left scan
332 * `foldl'` strict left fold
333 * `foldlM'` strict left fold with a monadic fold function
334 * `serial` run two streams serially one after the other
335 * `async` run two streams asynchronously
336 * `parallel` run two streams in parallel (replaces `<|>`)
337 * `WAsyncT` stream type for BFS version of `AsyncT` composition
338* Add simpler stream types that are specialized to the IO monad
339* Put a bound (1500) on the output buffer used for asynchronous tasks
340* Put a limit (1500) on the number of threads used for Async and WAsync types
342## 0.1.2
344### Enhancements
345* Add `iterate`, `iterateM` stream operations
347### Bug Fixes
348* Fixed a bug that casued unexpected behavior when `pure` was used to inject
349 values in Applicative composition of `ZipStream` and `ZipAsync` types.
351## 0.1.1
353### Enhancements
354* Make `cons` right associative and provide an operator form `.:` for it
355* Add `null`, `tail`, `reverse`, `replicateM`, `scan` stream operations
356* Improve performance of some stream operations (`foldl`, `dropWhile`)
358### Bug Fixes
359* Fix the `product` operation. Earlier, it always returned 0 due to a bug
360* Fix the `last` operation, which returned `Nothing` for singleton streams
362## 0.1.0
364* Initial release