3 ms·
It sure would be nice if we could even "just" get them for error-handling... I didn't know that that's what their real name was. Is there a place that I can re
by fouric 5y ago
It sure would be nice if we could even "just" get them for error-handling...
I didn't know that that's what their real name was. Is there a place that I can read an easy-to-understand explanation of them without a lot of math?
- FridgeSeal 5y agoNot identical, but very related, this is an article on algebraic effects that’s really straightforward and well-written: https://overreacted.io/algebraic-effects-for-the-rest-of-us/ https://overreacted.io/algebraic-effects-for-the-rest-of-us/
- zvrba 5y agoI like the article, though... the problems it illustrates with effects are usually solved by DI/IoC containers. It even says so: > Effect handlers let us decouple the program logic from its concrete effect implementations without too much ceremony or boilerplate code. For example, we could completely override the behavior in tests to use a fake filesystem [..] Yes, I understand the fundamental difference between effects and DI (effects suspend the execution and search the call stack for the handler - like exceptions, but without immediate unwinding). Maybe we could solve the problem with code being able to throw arbitrary exceptions by injecting an "Error" interface as well and then using some discipline? (I.e., instead of throwing stuff directly, we invoke methods on the Error interface.) Actually, I have to think more about this. Thanks for the link, it gave me some food for thought.