[Git][ghc/ghc][wip/exception-context] hi

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue May 9 12:33:37 UTC 2023



Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC


Commits:
68027225 by Ben Gamari at 2023-05-09T08:33:30-04:00
hi

- - - - -


1 changed file:

- libraries/base/GHC/IO.hs


Changes:

=====================================
libraries/base/GHC/IO.hs
=====================================
@@ -188,7 +188,12 @@ catch   :: Exception e
         -> (e -> IO a)  -- ^ Handler to invoke if an exception is raised
         -> IO a
 -- See #exceptions_and_strictness#.
-catch io handler = catchNoCause io (\e -> withCausedBy e (handler e))
+catch (IO io) handler = IO $ catch# io handler'
+  where
+    handler' e =
+      case fromException e of
+        Just e' -> unIO (withCausedBy e $ handler e')
+        Nothing -> raiseIO# e
 
 -- | Catch an exception without adding a 'CausedBy' 'ExceptionContext' to any
 -- exceptions thrown by the handler. See the documentation of 'catch' for a



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/68027225a6a31e3dbaadee50139e15974c81ac7e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/68027225a6a31e3dbaadee50139e15974c81ac7e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230509/590f0311/attachment.html>


More information about the ghc-commits mailing list