Abstracting effects with continuations

26 points by crowdhailer 21 hours ago on lobsters | 3 comments

zetashift | 13 hours ago

What a nicely written article!

Are continuations a way to express algebraic effects? It looks eerily similar to it.

[OP] crowdhailer | 11 hours ago

Continuations are a part of algebraic effects. I wrote about them (and EYG) before https://crowdhailer.me/2025-02-14/algebraic-effects-are-a-functional-approach-to-manage-side-effects/

As I understand it algebraic effects requires language support. They also require an extensible data type, something Gleam doesn't have. What I have in this post is what I think is as close as I can get to algebraic effects in Gleam as it is today.

mplant | 7 hours ago

They can be supported in dynamic languages with dynamic delimited continuations. Prompt handlers in scheme are essentially algebraic effects, although there are no compile time checks to ensure you’ve installed a particular handler