I'm trying to update a package that uses 'Control.OldException' (works
with GHC 6.10.4).  Here is a relevant (and simplified) part:

import Control.OldException

-- | A predicate matching synchronous exceptions.
syncExceptions :: Exception -> Maybe Exception
syncExceptions (AsyncException _) = Nothing
syncExceptions e                  = Just e

throwAsync :: IO a
throwAsync = throwIO $ AsyncException StackOverflow

throwArith :: IO a
throwArith = throwIO $ ArithException DivideByZero

'syncExceptions' is usually used like this:

*Main> tryJust syncExceptions throwArith
Left divide by zero
*Main> tryJust syncExceptions throwAsync  -- pass through
*** Exception: stack overflow

The above doesn't work with GHC 7.6.3 because 'Control.OldException' [1]
was removed.  And 'Control.Exception' doesn't have the 'Exception' type.

Is there a way to adapt 'syncExceptions' to work with
'Control.Exception'?

[1] 
http://hackage.haskell.org/packages/archive/base/4.1.0.0/doc/html/Control-OldException.html

Attachment: pgpxks_kAP6YQ.pgp
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to