Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A weak form of algebraic effects are already very common: React hooks.

React hooks are different from full-blown algebraic effects in a couple ways:

- The handler for the hooks are already implemented for you, and you can't swap it out for a different handler. For example, the implementation of useState is fixed, and you can't swap it out for a different implementation.

- They're not multishot resumption. When a hook is raised, the handler can only handle it and resume it once. In a full-blown algebraic effect, the handler can resume the same raised effect multiple times.

- Algebraic effects usually come bundled together. Those effects have specific compositional rules with each other. That's how they're algebraic.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: