←back to thread

97 points appliku | 1 comments | | HN request time: 0.252s | source
Show context
voat ◴[] No.45158518[source]
The algebraic effect handler pattern is a much simpler mental model than monads. And is transferrable to other languages pretty easily. See something like https://github.com/doeixd/effectively in Typescript
replies(2): >>45158694 #>>45158894 #
mrkeen ◴[] No.45158894[source]
I use effects to make guarantees about what the code will and won't do.

When Option was retrofitted onto Java, the NPEs didn't disappear. We got Options that could be null, but more importantly, devs (and the standard library) continued to use null liberally. We never ended up at the tautological goal of "if I have a Person, then I have a Person".

I am equally skeptical of bolting on effect systems after the fact. Even if one of these effect systems becomes 'the main one' and starts showing up in standard libraries, we'll still end up with declared-effectful code and undeclared-effectful code, but will again fall short of the goal, declared-effectful code.

replies(3): >>45159979 #>>45161014 #>>45161679 #
1. IshKebab ◴[] No.45159979[source]
I agree, this seems like something where it really needs to be natively supported in the language from day one to work properly.