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
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.
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.
iamwil|9 months ago
But yes, you can implement single-shot effects with generators.
yen223|9 months ago
It would be cool to see how generators will be implemented with algebraic effects.