-
Notifications
You must be signed in to change notification settings - Fork 333
Polysemy concurrency effect #2748
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
Polysemy concurrency effect #2748
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
I just have one tiny comment in a sequential interpreter, but even if my comment is valid, I think we can do that in a follow-up PR to fix it.
@@ -4,6 +4,9 @@ import Imports | |||
import Polysemy | |||
import Wire.Sem.Concurrency | |||
|
|||
------------------------------------------------------------------------------ | |||
|
|||
-- | Safely perform "concurrency" by doing it sequentially. | |||
sequentiallyPerformConcurrency :: Sem (Concurrency safe ': r) a -> Sem r a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have been 'Safe
instead of safe
in the type :: Sem (Concurrency safe ': r) a -> Sem r a
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isovector , I guess this has slipped your attention because I merged this before you got a chance to reply. Here's just a reminder.
@isovector , I just pushed an empty commit to your fork/branch to trigger our CI that otherwise has a hard time figuring out it should run. I hope this is fine by you. Otherwise I can copy your branch into |
@mdimjasevic thanks for being on top of it! |
This PR adds a
Concurrency
effect topolysemy-wire-zoo
, which lifts behavior fromunliftio
for splitting up tasks over multiple threads. In general, this is unsafe in application code and polysemy doesn't handle it very well, and in most cases it is going to create surprising bugs if it's used in application code.That being said, there are "safe" usages of
Concurrency
where the only actions being lifted areIO
, which is something interpreters can guarantee. TheConcurrency
effect tracks enforces this safety constraint at the type level.Checklist
changelog.d