effectful-streamly: Concurrent Streamly streams in Effectful

[ bsd3, concurrency, control, library, streaming ] [ Propose Tags ] [ Report a vulnerability ]

Streamly runs concurrent streams in worker threads, which the default unlifting strategy of Effectful refuses. This package makes the concurrent combinators of streamly work in Eff: a drop-in replacement for Streamly.Data.Stream.Prelude, and the wrapper it is built on.


[Skip to Readme]

Modules

  • Effectful
    • Effectful.Streamly
      • Effectful.Streamly.Stream

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.19 && <4.22), effectful-core (>=2.7.1 && <2.8), streamly (>=0.11.1 && <0.12), streamly-core (>=0.3.3 && <0.4) [details]
Tested with ghc ==9.8.4 || ==9.10.3 || ==9.12.4
License BSD-3-Clause
Author Xavier Dectot
Maintainer Xavier Dectot <xavier@wheredoibegin.fr>
Uploaded by GdeVolpiano at 2026-11-28T10:01:15Z
Category Control, Streaming, Concurrency
Home page https://github.com/GuillaumedeVolpiano/effectful-streamly
Source repo head: git clone https://github.com/GuillaumedeVolpiano/effectful-streamly.git
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2026-11-28 [all 1 reports]

Readme for effectful-streamly-0.1.0.0

[back to package description]

effectful-streamly

Concurrent Streamly streams in Effectful.

Streamly evaluates concurrent streams in worker threads and reaches the base monad through MonadBaseControl. Eff implements it with the unlifting strategy of its IOE context, whose default refuses to run in another thread: parList, parMapM and the other concurrent combinators fail in Eff unless that strategy is changed.

This package changes it for you:

  • Effectful.Streamly.Stream replaces Streamly.Data.Stream.Prelude. The serial API is re-exported as it is; every concurrent combinator works in Eff, whatever the strategy of the code that consumes the stream.
  • Effectful.Streamly holds the wrapper it is built on, concurrently, for streams built some other way.
import Effectful (Eff, IOE, liftIO, (:>))
import Effectful.Streamly.Stream (fromList, parMapM, toList)

lengths :: IOE :> es => [FilePath] -> Eff es [Int]
lengths paths = toList (parMapM id (fmap length . liftIO . readFile) (fromList paths))

Effects in worker threads

Each worker gets its own copy of the environment, as in any thread that Effectful forks:

  • effects with local state, such as Effectful.State.Static.Local, are not shared: a change made by a worker stays in that worker;
  • shared effects, such as Effectful.State.Static.Shared, are seen by everyone;
  • an Error thrown in a worker reaches the handler of the consumer, and so does an exception.

Known defects of streamly 0.11.1

takeInterval always yields an empty stream, and dropInterval drops nothing when the stream yields at once (streamly#3271). The wrappers keep that behaviour; a test records it.

Tested with GHC 9.8.4, 9.10.3 and 9.12.4, effectful 2.7.1, streamly 0.11.1.

License

BSD-3-Clause. See LICENSE.