top | item 45160507

(no title)

alethic | 5 months ago

The checked exceptions analogy is a good one. Thinking of effect handlers as resumable checked exceptions with some syntactic sugar is very accurate. For someone with a Haskell background, thinking about them as "dependency injection" is also helpful (and these notions are equivalent!) but for the Java heads out there, yeah, resumable checked exceptions provides a really good mental model for what effect handlers are doing with the call stack in the general case.

discuss

order

tome|5 months ago

What’s the difference between a resumable checked exception and a function call?

saviorand|5 months ago

Function call always returns, and to one single caller, whereas effects can choose not to "return" at all, resume multiple times, etc