https://github.com/dotty-cps-async/dotty-cps-async
experimental CPS transformer for dotty
https://github.com/dotty-cps-async/dotty-cps-async
async continuation cps dotty monad scala scala-async scala-js transformation
Last synced: about 2 months ago
JSON representation
experimental CPS transformer for dotty
- Host: GitHub
- URL: https://github.com/dotty-cps-async/dotty-cps-async
- Owner: dotty-cps-async
- License: apache-2.0
- Created: 2020-01-01T06:44:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-03-02T14:44:10.000Z (3 months ago)
- Last Synced: 2026-03-02T17:49:33.390Z (3 months ago)
- Topics: async, continuation, cps, dotty, monad, scala, scala-async, scala-js, transformation
- Language: Scala
- Homepage:
- Size: 19.1 MB
- Stars: 194
- Watchers: 11
- Forks: 23
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Authors: AUTHORS.md
- Notice: NOTICE
Awesome Lists containing this project
README
# 🇺🇦 HELP UKRAINE
I'm the creator of this project.
My country, Ukraine, [is being invaded by the Russian Federation, right now](https://war.ukraine.ua). If you want to help my country to fight, consider donating to [charity supporting Ukrainian army](https://www.comebackalive.in.ua/). More options is described on [support ukraine](https://supportukrainenow.org/) site.
# dotty-cps-async
This is the implementation of async/await transformation for [Scala 3][scala3] (Dotty), based on an optimized version of [CPS] (*Continuation Passing Style*) transformation, where the continuation is ‘pushed’ to the monad.
## Highlights
* Full support of all Scala language constructs in async/await block.
* Pluggable monad interface:
* An await monad can be any trait for which it is possible to implement [`CpsAsyncMonad`](https://github.com/rssh/dotty-cps-async/blob/master/shared/src/main/scala/cps/CpsMonad.scala) type class. You can provide those methods for your favorite monad.
* Limited support of high-order functions:
* ```urls.map(fetchData(_))(await _ )``` is an idiomatic way to fetch data for all items in parallel.
* An application developer or library author can provide 'shifted' implementation of the own high-order functions.
* Optional features, which enhance ergonomics in some cases, such as automatic coloring and handling discarded values
* Optional [SIP-22 compatible API][sip_22].
For more details, please, read the documentation at https://dotty-cps-async.github.io/dotty-cps-async/.
## Presentations
* Embedding generic monadic transformers into scala.
* Trends in Functional Programming 2022. https://www.slideshare.net/rssh1/embedding-generic-monadic-transformer-into-scala-tfp2022 (May 2022)
* Scala3 & Async: Behind Futures.
* Svitla Smart Talk. https://www.youtube.com/watch?v=fBcGhjM2s-c (April 2021. In Ukrainian language).
* Can we free concurrent programming from the monadic style?
* ScalaR: https://www.youtube.com/watch?v=ImlUuTQUeaQ (June 2020)
* ScalaUA: https://www.youtube.com/watch?v=w-noRPLxYoA&t=3s (April 2020)
(slides: https://www.slideshare.net/rssh1/can-concurrent-functional-programming-be-liberated-from-monadic-style )
[cps]: https://en.wikipedia.org/wiki/Continuation-passing_style
[scala3]: https://dotty.epfl.ch/
[sip_22]: https://docs.scala-lang.org/sips/async.html