extensible-exceptions 0.1.1.0 → 0.1.1.1
raw patch · 2 files changed
+30/−20 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
Control/Exception/Extensible.hs view
@@ -201,26 +201,31 @@ => IO a -- ^ The computation to run -> (e -> IO a) -- ^ Handler to invoke if an exception is raised -> IO a-catch io handler = io `E.catch` handler'- where handler' e = case fromException (toException e) of- Just e' ->- -- Handle the case where e == E.Exception,- -- or one of the types that make up E.Exception- handler e'- Nothing ->- case e of+catch io poly_handler = io `E.catch` handler'+ where + -- First look for "new style" exceptions, which are thrown+ -- as E.DynException (SomeException e)++ -- needs scoped TVs: handler' :: E.Exception -> IO a + handler' e = case e of E.DynException dyn -> case fromDynamic dyn of- Just (SomeException exc) ->- case cast exc of- Just e' ->- -- Handle the case where we have- -- a new exception type encoded- -- as a Dynamic- handler e'- Nothing -> E.throw e- Nothing -> E.throw e- _ -> E.throw e+ Just se@(SomeException _) ->+ case fromException se of+ Just e' -> poly_handler e'+ Nothing -> E.throw e+ Nothing -> try_old e+ _ -> try_old e++ -- If it's a legacy exception (E.Exception or one of the+ -- types that make up E.Exception), check for a handler than+ -- can handle them:++ -- needs scoped TVs: try_old :: E.Exception -> IO a+ try_old e = case fromException (toException e) of+ Just e' -> poly_handler e'+ Nothing -> E.throw e+ -- | When you want to acquire a resource, do some work with it, and -- then release the resource, it is a good idea to use 'bracket',
extensible-exceptions.cabal view
@@ -1,14 +1,19 @@ name: extensible-exceptions-version: 0.1.1.0+version: 0.1.1.1 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org+bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29 synopsis: Extensible exceptions description: This package provides extensible exceptions for both new and old versions of GHC (i.e., < 6.10).-cabal-version: >=1.2+cabal-version: >=1.6 build-type: Simple++source-repository head+ type: darcs+ location: http://darcs.haskell.org/packages/extensible-exceptions/ Library { if impl(ghc>=6.9)