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

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Oct 20 02:16:20 UTC 2022



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


Commits:
6a8fa5b4 by Ben Gamari at 2022-10-19T22:02:47-04:00
hi

- - - - -


1 changed file:

- libraries/base/GHC/Exception/Type.hs


Changes:

=====================================
libraries/base/GHC/Exception/Type.hs
=====================================
@@ -55,7 +55,7 @@ exceptionContext (SomeException _) = ?exc_context
 -- | Add more 'ExceptionContext' to a 'SomeException'.
 addExceptionContext :: ExceptionContext -> SomeException -> SomeException
 addExceptionContext ctxt' se@(SomeException e) =
-    let ?ctxt = exceptionContext se `mergeExceptionContexts` ctxt'
+    let ?exc_context = exceptionContext se `mergeExceptionContexts` ctxt'
     in SomeException e
 
 -- | @since 3.0
@@ -169,9 +169,7 @@ class (Typeable e, Show e) => Exception e where
 -- | @since 3.0
 instance Exception SomeException where
     toException se = se
-    toExceptionWithContext se@(SomeException e) ctxt =
-        SomeException e
-      where ?exc_context = ctxt <> exceptionContext se
+    toExceptionWithContext se ctxt = addExceptionContext ctxt se
     fromException = Just
     displayException (SomeException e) =
         displayException e ++ "\n" ++ displayContext ?exc_context



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6a8fa5b4e0961a023d04cef1f01af5eb8b3d5a4f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6a8fa5b4e0961a023d04cef1f01af5eb8b3d5a4f
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/20221019/40c60dc2/attachment-0001.html>


More information about the ghc-commits mailing list