The example for the Yield effect [1] looks suspiciously like the condition system of Common Lisp and restarts.
# By default Yield throws an exception
global Yield = function(n) {throw n};
def example() = {
var produce = true;
var n = 0;
while (produce) {
produce = Yield(n)
n = n + 1
}
println("done")
}
# Temporarily set the global Yield to be a different function
with(Yield = function(n) {
println(n);
return n < 3;}) {
example();
}
Where algebraic effects typically differ is that the handler receives a continuation. Potentially you could do more with that than just resume. You could for example store that continuation and build coroutines that way. That makes them essentially the same as delimited continuations. That's something that Common Lisp does not support.I'm not sure how that works in Effekt though. Since there seems to be a 'resume' keyword they might not be as powerful as delimited continuations.
Makes me very curious about both CL restarts (never used them for real) and AEff
That's a pretty good book (admittedly I have not finished it yet, life got in the way) about CL's condition system. Worth a read if it's something that interests you. Also, I'm pretty sure that price dropped a lot from when I last looked. $10 for the print book isn't a bad price, and $7 for the ebook.