[Haskell] Catching error / making library functions monadic (in failure)

Philip K.F. Hölzenspies p.k.f.holzenspies at utwente.nl
Wed Oct 8 10:58:27 EDT 2008


On Wednesday 08 October 2008 16:42:16 Mitchell, Neil wrote:
> You might want to take a look at the Safe library, which does pretty close
> to what you request.
>
> http://www-users.cs.york.ac.uk/~ndm/safe/
>
> (or cabal install safe)
>
> I would happily accept a patch adding *Fail variants that failed in some
> appropriate Monad if that is what you want.

Dear Mitchell,

This is what I want, but only for those functions. I use quite a few functions 
that produce errors (also from gtk2hs). These functions have been programmed 
using "error." Would these functions have been programmed with "abort," all 
would be honkey-dory. That is, unfortunately, not the case, so I'm still 
looking for a way to catch the existing errors thrown. In the smallest 
scenario:

some_catch_function (error "foo") (error "bar")

should result in an error "bar"

Regards,
Philip



More information about the Haskell mailing list