mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 19:47:10 +03:00
Fix overview of Stream module
This commit is contained in:
parent
f1ae6209cd
commit
60b8920b26
@ -8,16 +8,17 @@
|
||||
-- Stability : released
|
||||
-- Portability : GHC
|
||||
--
|
||||
-- Streamly is a framework for modular data flow based programming and
|
||||
-- declarative concurrency. Powerful stream fusion framework in streamly
|
||||
-- allows high performance combinatorial programming even when using byte level
|
||||
-- streams. Streamly API is similar to Haskell lists.
|
||||
-- The 'Stream' type represents a producer of a sequence of values, the
|
||||
-- corresponding dual type is 'Streamly.Data.Fold.Fold' which represents a
|
||||
-- consumer. Both types can perform equivalent transformations on a stream. But
|
||||
-- only 'Fold' can be used to compose multiple consumers and only 'Stream' can
|
||||
-- be used to compose multiple producers.
|
||||
--
|
||||
-- Streams are represented as state machines, that fuse together when composed
|
||||
-- statically, eliminating function calls or intermediate constructor
|
||||
-- allocations - generating tight, efficient loops similar to code generated by
|
||||
-- low level languages like C. Suitable for high performance looping
|
||||
-- operations.
|
||||
-- The 'Stream' type represents streams as state machines, that fuse together
|
||||
-- when composed statically, eliminating function calls or intermediate
|
||||
-- constructor allocations. Stream fusion helps generate tight, efficient loops
|
||||
-- similar to the code generated by low-level languages like C. Streams are
|
||||
-- suitable for high-performance looping operations.
|
||||
--
|
||||
-- Operations in this module are not meant to be used recursively. In other
|
||||
-- words, they are supposed to be composed statically rather than dynamically.
|
||||
@ -25,6 +26,14 @@
|
||||
-- stream operations from the "Streamly.Data.StreamK" module. 'Stream' and
|
||||
-- 'Streamly.Data.StreamK.StreamK' types are interconvertible.
|
||||
--
|
||||
-- Operations in this module are designed to be composed statically rather than
|
||||
-- dynamically. They are inlined to enable static fusion. More importantly,
|
||||
-- they are not designed to be used recursively. Recursive use will break
|
||||
-- fusion and will lead to quadratic performance slowdown. For dynamic or
|
||||
-- recursive composition use the continuation passing style (CPS) operations
|
||||
-- from the "Streamly.Data.StreamK" module. 'Stream' and
|
||||
-- 'Streamly.Data.StreamK.StreamK' types are interconvertible.
|
||||
--
|
||||
-- Please refer to "Streamly.Internal.Data.Stream" for more functions that have
|
||||
-- not yet been released.
|
||||
--
|
||||
@ -122,7 +131,7 @@ module Streamly.Data.Stream
|
||||
-- to a list and converting it to stream. The following works but is not
|
||||
-- particularly efficient:
|
||||
--
|
||||
-- >>> s from then = Stream.fromList $ Prelude.enumFromThen from then
|
||||
-- >>> f from next = Stream.fromList $ Prelude.enumFromThen from next
|
||||
--
|
||||
-- Note: For lists, using enumeration functions e.g. 'Prelude.enumFromThen'
|
||||
-- turns out to be slightly faster than the idioms like @[from, then..]@.
|
||||
|
Loading…
Reference in New Issue
Block a user