The Koka programming language
21 points by gnyeki
21 points by gnyeki
There have been a few posts about Koka in the past. (I think @david_chisnall may have worked on it once?)
The effect system is pretty interesting. Kotlin recently added a “context parameters” feature that can be used to implement effects, though I haven’t tried using it for that yet.
I’m a bit confused by the statement that Koka effect calls are translated into C longjmp, because there’s no way to return back to the caller from longjmp. Maybe calling an effect is a regular call to a function pointer, and then if the effect handler doesn’t want to resume the caller it uses longjmp.
You can read the paper[1] that explains how Koka’s algebraic effects are implemented in a way that is compatible with C.
[1] Ningning Xie and Daan Leijen. 2021. Generalized evidence passing for effect handlers: efficient compilation of effect handlers to C. Proc. ACM Program. Lang. 5, ICFP, Article 71 (August 2021), 30 pages. https://doi.org/10.1145/3473576