Get the latest tech news

Coroutines and Effects


For the past few months I’ve been mulling over some things that Russell Johnston made me realize about the relationship between effect systems and coroutines. You can read more of his thoughts on this subject here, but he made me realize that effect systems (like that found in Koka) and coroutines (like Rust’s async functions or generators) are in some ways isomorphic to one another.

You can read more of his thoughts on this subject here, but he made me realize that effect systems (like that found in Koka) and coroutines (like Rust’s async functions or generators) are in some ways isomorphic to one another. An example in this category would be the async/await feature in dynamically typed languages like Python and JavaScript; you must annotate asynchronous calls with await to get their result, but if you fail to do so it is not a compile-time error.) Overall, coroutines strike me as the most promising way to handle many kinds of effectful functions because they seem to be in the design sweet spot: They are statically typed, lexically scoped, and unlayered.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of effects

effects

Photo of Coroutines

Coroutines

Related news:

News photo

Employers feel the side effects of drugmaker control over Wegovy, Ozempic costs

News photo

How Super Mario Bros. Wonder's devs narrowed down 2000 ideas for its effects

News photo

Medics design AI tool to predict side-effects in breast cancer patients