6 ms·
I'm very impressed that they managed to express in Typescript type system what looks like algebraic effects, and that the monadic code shown in the docs doesn't
by pzmarzly 3y ago
I'm very impressed that they managed to express in Typescript type system what looks like algebraic effects, and that the monadic code shown in the docs doesn't look that bad. But TS was not made with that in mind, so I pity whoever has to debug a type error somewhere deep in the code there (probably because some code returns plain JS object instead of computation of it, or the other way around). I think we need to wait for new languages to appear before we can enjoy effective programming with useful compiler errors.
In case you wonder what I mean by "algebraic effects" - your code can make a call to something that may or may not return, is defined based on its environment (was set in some code above in the stack) and may have any side effect. Think "try-catch" but with extra operator to go back to place where exception was thrown and continue from there.