[Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

Yifan Yu yvifan at gmail.com
Wed Jul 18 05:28:34 CEST 2012


On Wed, Jul 18, 2012 at 7:05 AM, Ertugrul Söylemez <es at ertes.de> wrote:

> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120718/b2aa100f/attachment.htm>


More information about the Haskell-Cafe mailing list