HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulestreamly-0.10.1Haskell2010

Streamly.Internal.Data.Stream.SVar

Deprecated. This module will be removed in future.

  • 9 values
  • Packagestreamly-0.10.1
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEliminate.hs
valuetoSVarParallel
  1. :: MonadAsync m
  2. => State t m a
  3. -> SVar t m a
  4. -> Stream m a
  5. -> m ()
#

Fold the supplied stream to the SVar asynchronously using Parallel concurrency style. {-# INLINE [1] toSVarParallel #-}

valuenewFoldSVar
  1. :: MonadAsync m
  2. => State Stream m a
  3. -> SerialT m a -> m b
  4. -> m (SVar Stream m a)
#

Create a Fold style SVar that runs a supplied fold function as the consumer. Any elements sent to the SVar are consumed by the supplied fold function.

valuefromConsumer :: MonadAsync m => SVar Stream m a -> m Bool
#

Poll for events sent by the fold consumer to the stream pusher. The fold consumer can send a Stop event or an exception. When a Stop is received this function returns True. If an exception is recieved then it throws the exception.

valuepushToFold :: MonadAsync m => SVar Stream m a -> a -> m Bool
#

Push values from a stream to a fold worker via an SVar. Before pushing a value to the SVar it polls for events received from the fold consumer. If a stop event is received then it returns True otherwise false. Propagates exceptions received from the fold consumer.

valueteeToSVar :: MonadAsync m => SVar Stream m a -> SerialT m a -> SerialT m a
#

Tap a stream and send the elements to the specified SVar in addition to yielding them again. The SVar runs a fold consumer. Elements are tapped and sent to the SVar until the fold finishes. Any exceptions from the fold evaluation are propagated in the current thread.


------input stream---------output stream----->
                   /|\   |
        exceptions  |    |  input
                    |   \|/
                    ----SVar
                         |
                        Fold

valuefromSVar :: MonadAsync m => SVar Stream m a -> SerialT m a
#

Generate a stream from an SVar. An unevaluated stream can be pushed to an SVar using toSVar. As we pull a stream from the SVar the input stream gets evaluated concurrently. The evaluation depends on the SVar style and the configuration parameters e.g. using the maxBuffer/maxThreads combinators.