4 ms·
exactly, the monad "erases" the error, at least in the "happy path", while go makes it first citizen. one is not better than the other. I care a lot about erro
by larve 4y ago
exactly, the monad "erases" the error, at least in the "happy path", while go makes it first citizen. one is not better than the other.
I care a lot about errors, for logging, for metrics (how many connection errors did people from canada have last month?), for custom error handling (UX), for lower stack depth, etc... With tools like github copilot, I can now write extensive error handling code at the speed of my tab-key, which is a game-changer.
But if your team likes monads and doesn't care about errors (or you have other monads you can now lift into this with a single line of haskell), or you want to have a nice functional separation for easier unit testing and less coupled codebase, then the monadic approach makes more sense.
But that choice is one you can make even if you think in terms of monads when doing error handling.