See API Changelog for a complete list of signature changes and new APIs introduced.
fold: this function may now terminate early without consuming the entire stream. For example,
fold Fold.head streamwould now terminate immediately after consuming the head element from
stream. This may result in change of behavior in existing programs if the program relies on the evaluation of the full stream.
Streamly.Data.Fold.Teemodule, please use the
Teetype to adapt to the changes.
finallynow also work correctly on streams that aren’t fully drained. Also, the resource acquisition and release is atomic with respect to async exceptions.
iterateMnow consume O(1) space instead of O(n).
fromFoldableMis fixed to be concurrent.
connectAPIs now close the socket if an exception is thrown.
acceptnow closes the socket if an exception is thrown.
use-c-mallocbuild flag to use the c library
mallocfor array allocations. This could be useful to avoid pinned memory fragmentation.
Foldtype has changed to accommodate terminating folds.
classifySessionsBynow flushes sessions at the end and terminates.
Functorinstances of the
primitivepackage version >= 0.5.4 && <= 0.6.4.0
QuickCheckpackage version >= 2.14 && < 2.15.
findIndicesto return wrong indices in some cases.
chunksOfthat caused memory consumption to increase in some cases.
ahead) that caused memory consumption to increase with the number of elements in the stream, especially when built with
-threadedand used with
-NRTS option. The issue occurs only in cases when a worker thread happens to be used continuously for a long time.
containerspackage version < 0.5.8.
networkpackage version >= 22.214.171.124 && < 126.96.36.199.
Streamly.Network.Inet.TCPno longer use TCP
ReuseAddrsocket options by default. These options can now be specified using appropriate combinators.
fusion-pluginpackage for predictable stream fusion optimizations
foldrMto ensure that it is lazy
iterateMto ensure that it is lazy.
scanxwould now require an additional
ParallelTwas unaffected by
maxBuffercan limit the buffer of a
ParallelTstream as well. When the buffer becomes full, the producer threads block.
ParallelTstreams no longer have an unlimited buffer by default. Now the buffer for parallel streams is limited to 1500 by default, the same as other concurrent stream types.
runStreamhas been replaced by
runNhas been replaced by
runWhilehas been replaced by
fromHandlehas been deprecated. Please use
Streamly.Data.Fold.toListto split the stream to a stream of
Stringseparated by a newline.
toHandlehas been deprecated. Please use
concatUnfoldto add newlines to a stream,
Streamly.Data.Unicode.Stream.encodeUtf8for encoding and
Streamly.FileSystem.Handle.writefor writing to a file handle.
scanwith a new signature, to scan using Fold.
runStreamhas been deprecated, please use
Streamly.Time(moved to Streamly.Internal.Data.Time)
Streamly.Internal(functionality moved to the Internal hierarchy)
uniqfunction to yield the same element twice.
parallelcombinator. The bug manifests when large streams are combined using
This release contains a lot of new features and major enhancements. For more details on the new features described below please see the haddock docs of the modules on hackage.
Streamly.Prelude for new exception handling combinators like
Streamly.Data.Fold module provides composable folds (stream consumers). Folds allow splitting, grouping, partitioning, unzipping and nesting a stream onto multiple folds without breaking the stream. Combinators are provided for temporal and spatial window based fold operations, for example, to support folding and aggregating data for timeout or inactivity based sessions.
Streamly.Data.Unfold module provides composable stream generators. Unfolds allow high performance merging/flattening/combining of stream generators.
Streamly.FileSystem.Handle provides handle based streaming file IO operations.
Streamly.Network.Socket provides socket based streaming network IO operations.
Streamly.Network.Inet.TCP provides combinators to build Inet/TCP clients and servers.
Streamly.Prelude combinator performs a
concatMap using a supplied merge/concat strategy. This is a very powerful combinator as you can, for example, concat streams concurrently using this.
Streamly.Data.Unicode.Streammodule provides encoding/decoding of character streams and other character stream operations.
Streamly.Memory.Arraymodule provides arrays for efficient in-memory buffering and efficient interfacing with IO.
concatUnfoldto concat a stream after unfolding each element
intersperseintersperse an element in between consecutive elements in stream
tracecombinator maps a monadic function on a stream just for side effects
tapredirects a copy of the stream to a
maxThreadsdirective to be ignored when rate control was not used.
Monadconstraint may be needed on some of the existing APIs (
Identity: IsList, Eq, Ord, Show, Read, IsString, NFData, NFData1, Traversable
StateT. Particularly, this bug cannot affect
wSerialcombinators. Without this fix combinators that rely on state passing e.g.
maxBufferwon’t work across these combinators.
constRateto control the yield rate of a stream.
Streamly.Timemodule is now deprecated, its functionality is subsumed by the new rate limiting combinators.
Monadconstraint on the underlying type of the stream.
oncehas been deprecated and renamed to
takeis now limited by the number of elements demanded by
yieldto construct a singleton stream from a pure value
repeatto generate an infinite stream by repeating a pure value
fromListMto generate streams from lists, faster than
mapas a synonym of fmap
scanlM', the monadic version of scanl’
fromFoldableMAPI that creates a stream from a container of monadic actions
fromFoldableMcan now generate streams concurrently when used with concurrent stream types.
sequencecan now map actions concurrently when used at appropriate stream types.
Changed the semantics of the Semigroup instance for
ParallelT. The new semantics are as follows:
<>operation interleaves two streams
<>now concurrently merges two streams in a left biased manner using demand based concurrency.
<>operation now concurrently meges the two streams in a fairly parallel manner.
To adapt to the new changes, replace
serial wherever it is used for stream types other than
Alternative instance. To adapt to this change replace any usage of
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:
SerialTinstead of a polymorphic type. This makes sure that the stream type is always fixed at all exits.
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
foldrM to make it consistent with
foldrM in base.
async is renamed to
async is now a new API with a different meaning.
ZipAsync is renamed to
ZipAsync is now ZipAsyncM specialized to the IO Monad.
MonadError instance as it was not working correctly for parallel compositions. Use
MonadThrow instead for error propagation.
Remove Num/Fractional/Floating instances as they are not very useful. Use
|:operator to construct streams from monadic actions
onceto create a singleton stream from a monadic action
repeatMto construct a stream by repeating a monadic action
scanl'strict left scan
foldl'strict left fold
foldlM'strict left fold with a monadic fold function
serialrun two streams serially one after the other
asyncrun two streams asynchronously
parallelrun two streams in parallel (replaces
WAsyncTstream type for BFS version of
purewas used to inject values in Applicative composition of
consright associative and provide an operator form
productoperation. Earlier, it always returned 0 due to a bug
lastoperation, which returned
Nothingfor singleton streams