r/functionalprogramming Jul 16 '26

FP Abstracting effects with continuations

https://crowdhailer.me/2026-07-15/abstracting-effects-with-continuations/

I've spent a while writing this post trying to work out if I want to talk about function coloring. In the end I chose to as neutrally as possible describe what continuations are.

17 Upvotes

5 comments sorted by

4

u/Practical-Bike8119 Jul 16 '26 edited Jul 16 '26

I haven't read the post yet, but I already have some feedback: The AI image in the header will likely put some people off. I have a pretty positive attitude towards generative AI but my instinctive reaction when I saw the image was to think, if it starts like this then the text is likely generated as well. Now imagine those people who passionately hate AI.

1

u/crowdhailer Jul 16 '26

Yeah I wondered about that. I use some AI and some not AI for my post hero images. I enjoyed the unnecessary moodyness of this image, but your right I probably don't need to bring that to this post.

2

u/Delta-9- Jul 16 '26 edited Jul 16 '26

Continuation Passing Style is OP for how overlooked it tends to be. It would be awesome if continuations were first-class in more languages, but to my knowledge only some Lisps and Ruby do that; most other languages fake it with higher-order functions. Tbf, HOFs are also OP, but doing CPS with only functions is dangerously close to callback hell.

2

u/crowdhailer Jul 16 '26

The use construct in Gleam is what makes it palatable. Without that it's definitely callback hell

1

u/RingularCirc 11d ago

...though please only delimited continuations, as even "classic" (undelimited) continuations are still delimited in practice, just with no control over it (usually at the point where OS executes our program), and delimited continuations look just like regular functions that can return a value.