+class Throwable e where
+ toThrowable :: e -> Throwable
+
+messageOfException :: Throwable e => e -> String
+messageOfException e = match getMessageThrowable $ toThrowable e with
+ Just m -> m
+ Nothing -> ""
+
+possibleMessageOfException :: Throwable e => e -> Maybe String
+possibleMessageOfException e = getMessageThrowable $ toThrowable e
+
+causeOfException :: Throwable e => e -> Maybe Throwable
+causeOfException = getCauseThrowable . toThrowable
+
+instance Throwable Throwable where
+ toThrowable = id
+instance Throwable Exception where
+ toThrowable = Java.unsafeCoerce
+