top | item 44079305

(no title)

nikita2206 | 9 months ago

Have you thought of using generators as a closest example to compare effects to? I think they are much closer to effects than exceptions are. Great explainer anyway, it was tge first time I have read about this idea and it was immediately obvious

discuss

order

iamwil|9 months ago

Full blown algebraic effects are multi-shot, meaning you can resume from the same raised effect multiple times. Generators can only resume from a point in the execution a single time.

But yes, you can implement single-shot effects with generators.

yen223|9 months ago

Exceptions are usually used because the syntax for "performing" exceptions (throw) vs handling exceptions (try-catch) is familiar to most programmers, and is basically the same as the syntax for "performing" an effect vs handling the effect, except that the latter also includes resuming a function.

It would be cool to see how generators will be implemented with algebraic effects.