-
Notifications
You must be signed in to change notification settings - Fork 57
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
More convenient direct syntax #713
Comments
I've prepared a prototype to explore the idea: https://gist.github.com/fwbrasil/bc8e27aeaf7c0c992b0d103638a71b90 It's possible to execute it with:
|
It is possible to call. |
Yes, the idea is to have wrapper APIs via |
The mix of code that requires await with code that doesn't require await is too confusing. Closing. |
I've been considering ways to make the direct syntax more convenient but with a smaller scope than #211. The integration with
dotty-cps-async
is working well but it'd be nice if we had a way to avoid the need forawait
calls. Currently, code using the direct syntax looks like this:To avoid the need for
await
, we could have wrappers of Kyo's regular APIs usingtransparent inline
to automatically insert the necessaryawait
s. Each API would have a counterpart in akyo.direct
package. Example forIO
:Users would then
import kyo.direct.*
instead ofimport kyo.*
, which wouldn't require explicitawait
s:We might hit limitations but my initial tests indicate it's a viable approach.
If we decide to proceed, I think we could merge
kyo-direct
intokyo-prelude
so the direct wrappers stay in the same module as their monadic APIs. Another option is having separate modules likekyo-prelude-direct
andkyo-core-direct
but I think it'd make maintenance harder and we might end up with too many modules.cc/ @rssh
The text was updated successfully, but these errors were encountered: