Comments (1)
There a few things to take care of in the sample code above:
- Make the callback caller block if a queue threshold at the consumer is reached, so that the queue does not grow arbitrarily.
- Use
atomicModifyIORef'
to ensure correctness when the second stream is evaluated from concurrent threads. - The callback is registered when the stream starts getting evaluated, so it may miss events from the source stream before that. That may or may not be ok depending on the use case.
- In general, the consumer stream needs to remove the callback from the list of callbacks when it is done, though it depends on the specific use case. For that it will have to associate some id with the callback. The IORef can keep an id counter for that and we can store a (id, callback) tuple.
- Exceptions in the consumer streams cannot be propagated back to the source stream.
from streamly.
Related Issues (20)
- Internal Parser module cleanup
- Internal Stream module cleanup
- Expose groupByRolling and groupByRollingEither parsers
- Change the Fold type from "Fold m a b" to "Fold a m b"
- Create a streamly-text package HOT 3
- Add -Werror build for GHC 9.4.4
- Add fusion plugin functionality to GHC
- Fusion plugin takes too long with spec-constr-recursive=16
- catRights, catLefts behavior
- Create a released equivalent of Stream.Chunked.splitOnSuffix
- API to create arrays from pure streams and string literals HOT 1
- Remove the capacity field in the unboxed mutable arrays? HOT 1
- Try non-sliceable non-expandable arrays to compare the perf difference HOT 1
- 0.9.0 fails to build when use-unliftio is enabled HOT 1
- Add a CI for GHC 9.6.1
- `wordWithQuotes` should have a functionatity to translate the ESC char at the end
- Unpredictable `ordered True` behavior. HOT 4
- Unexpected number of threads for `parConcatMap` (unordered).
- Tracking broken links
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamly.