-
Notifications
You must be signed in to change notification settings - Fork 68
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
Async capability combinators #179
Conversation
@charypar thanks for this, it looks great! I'm so excited to try this in my app. I think it will help a lot with maintainability. I have some places where the flow of orchestrated events is really hard to follow. In the example, there are two concurrent events, but it could easily be two sequential events, or any other orchestration, right? |
@wasnotrice Yea, absolutely, it's just an open ended async context with access to the capability runtime, I'm pretty sure it can orchestrate an arbitrary graph of dependent effects (and emit events along the way). One thing to be aware off is that it is likely to be quite hard to test "sub-steps" in isolation on long effect chains. The entire outer future is one atomic flow which can only be entered into at the top. |
b79a90c
to
18e4ddb
Compare
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.
yay!
This PR is work in progress on #91.
It turns out, surprisingly, that async capability combinators were always possible in "user land", and could be implemented as an additional capability, but the implementation is not exactly obvious, and this type of use needs to be supported by the capabilities being orchestrated across, especially
crux_http
.This PR aims to make the use of
async
across multiple capabilities more obvious. There are a few challenges to overcomeAutomatically derive- decided against, it would conflict with customClone
for capabilities and theCapabilities
struct, to avoid various lifetime errors when moving the capabilities or the context into the async blocksClone
implementationsNever
operation typeEffect
variant for capabilities who'soperations arefields areNever
()#[effect(skip)]
All feedback on the ergonomics of this is welcome at this stage, but I'd like to aim to ship this soon, ideally this week.