Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluefin and concurrency #28

Open
maralorn opened this issue Nov 24, 2024 · 4 comments
Open

Bluefin and concurrency #28

maralorn opened this issue Nov 24, 2024 · 4 comments

Comments

@maralorn
Copy link
Contributor

Hey Tom, still loving your lib. (And loved your recent talk on effectful vs. bluefin.)

I am considering to port https://github.com/maralorn/nix-output-monitor to bluefin which currently uses transformers and streamly.

For this I noticed that bluefin currently does not mention concurrency anywhere. So I would like to know whether you have any recommendations for combining bluefin with concurrency. (e.g. can I just use it with async?)
I am especially curious about State and Stream and whether I can just pass them to different threads.

@tomjaguarpaw
Copy link
Owner

Hey Tom, still loving your lib. (And loved your recent talk on effectful vs. bluefin.)

Oh great, I'm pleased to hear it!

Bluefin's State is not thread safe so I wouldn't recommend just using async unless you're very careful.

This is a good opportunity for me to improve the concurrency story though. Could you tell me what concurrency patterns you want to use? And maybe point me to what you're doing with concurrency in the current version?

@maralorn
Copy link
Contributor Author

maralorn commented Nov 24, 2024 via email

@tomjaguarpaw
Copy link
Owner

All data sharing between threads is done explicitly via STM.

OK, in that case you will be fine to use withEffToIO and your favourite functions from async. Eventually I'd like to guarantee concurrency safety through the type system, but for now let's do it the simple way.

So I could imagine just giving it a shot and telling you if encounter troubles.

Sounds good. Please let me know how it goes!

@tomjaguarpaw
Copy link
Owner

See also #34 for some discussion on native concurrency primitives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants