
On Wed, Jul 18, 2012 at 7:05 AM, Ertugrul Söylemez
exception handling should be done on a per-context basis, where the developer establishes the notion of context. Most of the time this boils down to releasing resources:
forkIO (doStuffWith h `finally` hClose h)
Hello Ertugrul, Agreed, although sometimes I just want to be lazy and catch any exception and see what it is in the top-level context :-)
In more complicated scenarios, where you actually need to /handle/ the exception you should probably wrap some control concept around it. There are many options. You could just catch and handle the exception. Other options include a resumable monad (like monad-coroutine) that brings everything back into a consistent state.
Finally for both efficiency and safety make use of a stream processing abstraction like conduit, enumerator or pipes.
Thank you for these interesting pointers, I'll look into them later.