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

Experiment with -Xasync #1907

Closed
djspiewak opened this issue Apr 15, 2021 · 8 comments · Fixed by #1924
Closed

Experiment with -Xasync #1907

djspiewak opened this issue Apr 15, 2021 · 8 comments · Fixed by #1924

Comments

@djspiewak
Copy link
Member

According to @retronym it works with Cats Effect. Let's like… actually do it. I would very much like it if users could opt-in to this syntax for interacting with at least IO, and ideally any effect type.

@Baccata
Copy link
Contributor

Baccata commented Apr 18, 2021

I've got something working. IOs are executed sequentially, and I haven't figured out why yet :

@renghen
Copy link

renghen commented Apr 26, 2021

https://github.com/rssh/cps-async-connect

Have same goal as async await, hope you can take some ideas

@Baccata
Copy link
Contributor

Baccata commented Apr 28, 2021

@renghen thanks for sharing, that's pretty cool !

Unfortunately in scala-2 land the integration point is much less straightforward (if you want to tap into the mechanism enabled by the -XAsync flag and not write complex AST transformations from scratch, that is). I really hope that if the flag gets ported to scala-3, the underlying mechanism will be similar to the one you offer in dotty-cps-async, and that if the flag wasn't ported for whatever reason, your library would be used as a point of reference to obtain feature parity.

On an unrelated note, I was thinking that at some point I'd try implementing arrow-comprehensions (similar to https://github.com/manatki/volga) in Scala 3, and you work seem like it'd be a good starting point (the macro examples on dotty's website lack depth)

Thanks again for sharing 😄

@renghen
Copy link

renghen commented Apr 28, 2021

one note this is not my work (https://github.com/rssh/cps-async-connect) I am just interested in Continuation passing style.
So I follow that repo and hope for something like suspend like in kotlin will get into scala.

I will also look into the git repo you mentioned.

cheers

@Baccata
Copy link
Contributor

Baccata commented Apr 28, 2021

Hah my bad. Still, thanks for sharing 😄

@b-studios
Copy link

I just want to mention that similar things can be achieved building on monadic reflection and project loom: https://github.com/b-studios/cats-reflect

  • The advantage is that you do not need a translation and it "just" works. In particular with higher-order functions like map.
  • The disadvantage is that you need a Loom runtime -- it is much easier now since pre-release binaries are available, but it is still not the standard.

@djspiewak
Copy link
Member Author

@b-studios That is really really cool

@b-studios
Copy link

b-studios commented May 24, 2021

Thanks @djspiewak! FYI, we moved our experiments here: https://github.com/lampepfl/monadic-reflection

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

Successfully merging a pull request may close this issue.

4 participants