3 ms·
Using a Maybe type sounds a bit better, but not really that different than how Go does it in practice. The key decision is whether to throw errors or return the
by danenania 7y ago
Using a Maybe type sounds a bit better, but not really that different than how Go does it in practice. The key decision is whether to throw errors or return them. Go's approach and the Maybe type are both variations on returning them.
The problem with returning them is it's tedious and you end up with error checking boilerplate everywhere.
The problem with throwing them is they're easy to ignore, and also you never know whether or not a function is capable of throwing an error, or what types of errors it can throw.
In conclusion, error handling sucks no matter how you do it :-/
- smabie 7y agoYeah, it does, but using monads to fold over errors is a lot nicer than what you have to do with Go.