Re:Algebraic Effects for the Rest of Us
by TeMPOraL on Wednesday July 24, 2019 @03:26AM
(#20513014)
Question about forking: isn't this essentially the same thing as restarts, after the garbage collector gets rid of the original (and now dangling) stack branch? Or is there something you can do with both of these branches simultaneously that's not expressible in conditions/restarts system?
[ Parent
| on HN ]
Re:Algebraic Effects for the Rest of Us
by dan-robertson on Wednesday July 24, 2019 @09:49AM
(#20515217)
The second: once a restart is invoked, the stack is unwound and so whatever was happening at the tip is forgotten. With an effect handler one is given a continuation (this might be a function or, as in ocaml, a special function-like thing which may be called only once), and you can put this to one side and do something else.
A common example for an application of algebraic effects would be implementing async/await like mechanisms. The effect handler would take the continuations and put them into a scheduler, so it’s stack would effectively be heavily forked.