Next Previous Contents

6.3 Dynamic Exceptions

Because the Exception datatype isn't extendible, we added an interface for throwing and catching exceptions of type Dynamic (see Section Dynamic), which allows exception values of any type in the Typeable class to be thrown and caught.

throwDyn :: Typeable exception => exception -> b
catchDyn :: Typeable exception => IO a -> (exception -> IO a) -> IO a

The catchDyn function only catches exceptions of the required type; all other exceptions are re-thrown as with catchIO and friends above.


Next Previous Contents