Hide implementation details of `throw` and `throwSTM`
Closes #26808 (closed)
throw exposed implementation details as it doesn't freeze the
CallStack:
HasCallStack backtrace:
collectExceptionAnnotation, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:170:37 in ghc-internal:GHC.Internal.Exception
toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:90:42 in ghc-internal:GHC.Internal.Exception
throw, called at T26806b.hs:17:9 in main:Main
The functions collectExceptionAnnotation and toExceptionWithBacktrace
are implementation details of throw that are noise to the end user.
Thus, we freeze the CallStack, no longer exposing these details.
Then the backtrace looks like:
HasCallStack backtrace:
throw, called at T26806b.hs:17:9 in main:Main
We do the same thing for throwSTM.
Further, we add regression tests to make sure that the stack traces do not accidentally
Edited by Hannes Siebenhandl