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

Martijn van Steenbergen martijn at van.steenbergen.nl
Wed Oct 8 13:45:36 EDT 2008

Hi Philip,

Philip K.F. Hölzenspies wrote:
> some_catch_function (error "foo") (error "bar")
> should result in an error "bar"

Take a look at the isBottom function which is defined in module 
Test.QuickCheck.Batch; it might be of value to you:

isBottom :: a -> Bool
isBottom a = unsafePerformIO (do
	a' <- try (Exception.evaluate a)
	case a' of
	   Left _ -> return True
	   Right _ -> return False)



More information about the Haskell mailing list