
On Feb 5, 2014, at 19:41 , Evan Laforge wrote:
But I think even with AsyncException as its own class you can't say "everything except", so it still requires an explicit rethrow, yes? E.g.:
case Exception.fromException exc of Just (exc :: Exception.AsyncException) -> Exception.throwIO exc Nothing -> return ()
Well, you can do: newtype AllBut e = AllBut SomeException deriving (Show, Typeable) instance forall e . Exception e => Exception (AllBut e) where fromException x = case fromException x :: Maybe e of Nothing -> Just (AllBut x) Just _ -> Nothing This lets you write "foo `catch` \(AllBut _ :: AllBut AsyncException) -> doStuff", which will catch everything *except* async exceptions. Cheers, Merijn