3 ms·
It's mistaken that you don't need a new language to implement full-blown algebraic effects. Full-blown algebraic effects are multi-shot, meaning that you can "
by iamwil 1y ago
It's mistaken that you don't need a new language to implement full-blown algebraic effects.
Full-blown algebraic effects are multi-shot, meaning that you can "resume the thrown exception" multiple times. The only way to do that is through delimited continuations, which isn't available as a feature in most languages, and can't be emulated by other language features--unless you reimplement the call stack in userland.
In addition, the handler can decide not to resume a raised effect at all, at which point it can exit. When it does, it's as if all the computation that it did when the handler wrapped the computation didn't happen at all. It's a way of doing backtracking. This is also possible due to delimited continuations.
Both are things that you can't do in the effects library.