HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulestreamly-0.10.1Haskell2010

Streamly.Internal.Data.Stream.ZipAsync

Deprecated. Use Streamly.Data.Stream.MkType instead.

To run examples in this module:

Example1 expression
import qualified Streamly.Prelude as Stream
  • 2 types
  • 3 values
  • Packagestreamly-0.10.1
  • Exports5
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceZipAsync.hs
newtypenewtype ZipAsyncM (m :: Type -> Type) a
#

For ZipAsyncM streams:

(<>) = Streamly.Prelude.serial
(*) = Streamly.Prelude.serial.zipAsyncWith id

Applicative evaluates the streams being zipped concurrently, the following would take half the time that it would take in serial zipping:

Example2 expressions
s = Stream.fromFoldableM $ Prelude.map delay [1, 1, 1]Stream.toList $ Stream.fromZipAsync $ (,) <$> s <*> s...[(1,1),(1,1),(1,1)]

Since: 0.2.0 (Streamly)

Constructors

Instances5IsStream, Functor, Applicative, Semigroup, Monoid
typetype ZipAsync = ZipAsyncM IO
#

An IO stream whose applicative instance zips streams wAsyncly.

Since: 0.2.0 (Streamly)

valuezipAsyncWithK
  1. :: MonadAsync m
  2. => a -> b -> c
  3. -> Stream m a
  4. -> Stream m b
  5. -> Stream m c
#

Like zipWith but zips concurrently i.e. both the streams being zipped are evaluated concurrently using the ParallelT concurrent evaluation style. The maximum number of elements of each stream evaluated in advance can be controlled by maxBuffer.

The stream ends if stream a or stream b ends. However, if stream b ends while we are still evaluating stream a and waiting for a result then stream will not end until after the evaluation of stream a finishes. This behavior can potentially be changed in future to end the stream immediately as soon as any of the stream end is detected.