HORIZON HASKELLDocslts/ghc-9.14.x7a6c33e2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 7a6c33e · 2026-10-12

Modulestreamly-0.11.1Haskell2010

Streamly.Internal.Data.Stream.SVar

Deprecated. This module will be removed in future.

Synopsis
  • Packagestreamly-0.11.1
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEliminate.hs
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.