News for hackers. Stuff that matters.
Re:Why Algebraic Effects? by charcircuit on Saturday May 24, 2025 @04:13AM (#44079649)
Again you are listing things that are possible but not explaining why it's better to do it via algebraic effects as opposed to the alternatives.
Re:Why Algebraic Effects? by cryptonector on Saturday May 24, 2025 @04:38AM (#44079722)
The only reason I can think of -but I'm not the right person to ask- is ergonomics, that in many cases it might be easier to push an effect handler than to build a whole monad or whatever. Elsewhere in this thread there's talk of effects solving the color problem.
Re:Why Algebraic Effects? by threeseed on Saturday May 24, 2025 @09:19AM (#44080923)
Take the following requirement:

"A user has made an API call. I want you to in parallel race two concurrent tasks: check if the data is in (1) cache and (2) database. Whichever returns fastest return to the user. Otherwise kill the other task mid-flight and make sure the connection resources for both are cleaned up".

This is trivial with an effect systems like ZIO and it will work flawlessly. That's the benefit of effect systems. Use cases like this are made easy.

But now with JVM Virtual Threads there are frameworks like Ox: https://github.com/softwaremill/ox which allow you to achieve the same thing without effects. And how many times do you really need that sort of capability ?