Ben Gamari pushed to branch wip/T27455 at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • changelog.d/T27455
    1
    +section: base
    
    2
    +issues: #27455
    
    3
    +mrs: 
    
    4
    +synopsis:
    
    5
    +  Don't drop `ExceptionContext` in `SomeException(toException)`
    
    6
    +description:
    
    7
    +  Previously the implementation of ``Exception(toException)`` given to `SomeException` would inappropriately drop the carried `ExceptionContext`. Now ``toException = id``, faithfully implementing the semantics proposed in :ref:`CLC Proposal #200 <https://github.com/haskell/core-libraries-committee/issues/200>`.
    
    8
    +

  • libraries/base/changelog.md
    ... ... @@ -33,6 +33,7 @@
    33 33
       * Evaluate backtraces for "error" exceptions at the moment they are thrown. ([CLC proposal #383](https://github.com/haskell/core-libraries-committee/issues/383))
    
    34 34
       * Hide implementation details when throwing exceptions in throw and throwSTM. ([CLC proposal #387](https://github.com/haskell/core-libraries-committee/issues/387))
    
    35 35
       * Change `hIsReadable` and `hIsWritable` such that they always throw a respective exception when encountering a closed or semi-closed handle, not just in the case of a file handle. ([CLC proposal #371](github.com/haskell/core-libraries-committee/issues/371))
    
    36
    +  * The implementation of `toException` in `SomeException`'s `Exception` instance no longer drops exception context, in keeping with the behavior originally proposed in [CLC Proposal #200](https://github.com/haskell/core-libraries-committee/issues/200).
    
    36 37
       * Annotate `onException` continuation with `WhileHandling`. ([CLC Proposal #397](https://github.com/haskell/core-libraries-committee/issues/397))
    
    37 38
       * Improve error message for `Data.Char.chr`. ([CLC Proposal #384](https://github.com/haskell/core-libraries-committee/issues/384))
    
    38 39
     
    

  • libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
    ... ... @@ -235,9 +235,7 @@ instance Exception Void
    235 235
     --
    
    236 236
     -- @since base-3.0
    
    237 237
     instance Exception SomeException where
    
    238
    -    toException (SomeException e) =
    
    239
    -        let ?exceptionContext = emptyExceptionContext
    
    240
    -        in SomeException e
    
    238
    +    toException = id
    
    241 239
         fromException = Just
    
    242 240
         backtraceDesired (SomeException e) = backtraceDesired e
    
    243 241
         displayException (SomeException e) = displayException e