logoalt Hacker News

lolinderyesterday at 2:04 AM2 repliesview on HN

Not just effects, multi-shot effects:

> Algebraic effects with deep, multi-shot handlers. A handler can resume a computation zero, one, or many times, which is what makes exhaustive search and exact inference ordinary library code.

I love me some algebraic effects, but this sets off alarm bells for me.

Multi-shot effects are neat and powerful but are incredibly difficult to reason about for humans, and given that there are few languages that have implemented them (and they're so niche with very little training data) I'm skeptical that LLMs are sufficiently better at them to make up the gap.

One-shot effects are a cross between `throw` and a function call. Multi-shot are full-on delimited continuations and come with all the complexity that entails.


Replies

ch4s3yesterday at 3:29 AM

> Multi-shot effects are neat and powerful but are incredibly difficult to reason about for humans

I had a very similar thought and ended up building a capability system[1] in my language to capture side effects.

[1] https://march-lang.org/docs/cookbook/capabilities/ * docs are a work in progress

jbwintersyesterday at 3:32 AM

That’s a fair concern. I’d expect multi-shot handlers to be relatively rare and mostly something library code uses rather than a day-to-day utility. But an LLM given free rein may decide to behave differently.

For now, I am looking into making a clearer distinction between one-shot and multi-shot handlers so we can reject cases where resuming again would be unsafe, like around filesystem writes.

More to explore here, certainly.