4 ms·
Those seem like orthogonal concerns. With both Monadic error handling and exceptions you can defer handling any error until you hit some boundary that you choos
by thinkharderdev 6y ago
Those seem like orthogonal concerns. With both Monadic error handling and exceptions you can defer handling any error until you hit some boundary that you choose. Likewise you can still choose to subsume specific errors into types that encompass lots of different specific error conditions. So the file cannot be opened, audio unavailable, GPU cannot be opened can still all be an IOError.
> Just write the happy / known-to-the-programmer path and let what you don't know about bubble up to main() or the top of your event loop.
I believe that is the point, an IO exception o some sort is a known exception case so the return type of the function should express that. This function can return either the contents of a file or an IOError if the file cannot be read for some reason. The caller can then decide whether they want to try and handle the exception case or ignore it and let it bubble up the stack, but the function should clearly express that it is a possible outcome.