Hannes Siebenhandl pushed to branch wip/fendor/stack-annotation-ty at Glasgow Haskell Compiler / GHC Commits: d40ddcc0 by fendor at 2026-02-16T12:05:15+01:00 Add optional `SrcLoc` to `StackAnnotation` class `StackAnnotation` give access to an optional `SrcLoc` field that stack annotations can use to provide better backtraces in both error messages and when decoding the callstack. We update builtin stack annotations such as `StringAnnotation` and `ShowAnnotation` to also capture the `SrcLoc` of the current `CallStack` to improve backtraces by default (if stack annotations are used). This change is backwards compatible with GHC 9.14.1. - - - - - 20 changed files: - libraries/ghc-experimental/CHANGELOG.md - libraries/ghc-experimental/src/GHC/Stack/Annotation/Experimental.hs - + libraries/ghc-experimental/tests/Makefile - + libraries/ghc-experimental/tests/all.T - + libraries/ghc-experimental/tests/backtraces/Makefile - + libraries/ghc-experimental/tests/backtraces/T26806a.hs - + libraries/ghc-experimental/tests/backtraces/T26806a.stderr - + libraries/ghc-experimental/tests/backtraces/T26806b.hs - + libraries/ghc-experimental/tests/backtraces/T26806b.stderr - + libraries/ghc-experimental/tests/backtraces/T26806c.hs - + libraries/ghc-experimental/tests/backtraces/T26806c.stderr - + libraries/ghc-experimental/tests/backtraces/all.T - libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs - libraries/ghc-internal/tests/stack-annotation/ann_frame001.stdout - libraries/ghc-internal/tests/stack-annotation/ann_frame002.stdout - libraries/ghc-internal/tests/stack-annotation/ann_frame003.stdout - libraries/ghc-internal/tests/stack-annotation/ann_frame004.stdout - libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout - testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32 Changes: ===================================== libraries/ghc-experimental/CHANGELOG.md ===================================== @@ -5,12 +5,17 @@ - New and/or/xor SIMD primops for bitwise logical operations, such as andDoubleX4#, orWord32X4#, xorInt8X16#, etc. These are supported by the LLVM backend and by the X86_64 NCG backend (for the latter, only for 128-wide vectors). -## ghc-experimental-9.1401.0, +## ghc-experimental-9.1402.0 + +- Add optional `SrcLoc` to `StackAnnotation` class in `GHC.Stack.Annotation.Experimental` + +## ghc-experimental-9.1401.0 - Expose access to RTS flags via `GHC.RTS.Flags.Experimental` - Expose access to era profiling interface via `GHC.Profiling.Eras` - Expose access to runtime stack annotations via `GHC.Stack.Annotation.Experimental` - Expose custom allocation limit handler via `System.Mem.Experimental` +- Expose access to Stack Annotations via `GHC.Stack.Annotation.Experimental` - Expose module Prelude.Experimental, which reexports some modules from ghc-experimental for convenience, like Prelude does for base. ## ghc-experimental-9.1201.0 ===================================== libraries/ghc-experimental/src/GHC/Stack/Annotation/Experimental.hs ===================================== @@ -82,9 +82,6 @@ import GHC.Internal.Stack.Annotation -- the pure variations can behave in ways that are hard to predict. -- -- See Note [Stack annotations in pure code] for more details. --- --- At last, stack annotations are tricky to use with 'error'. --- See Note [Pushing annotation frames on 'error'] for why this is the case. -- Note [Stack annotations in pure code] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -96,57 +93,50 @@ import GHC.Internal.Stack.Annotation -- For example: -- -- @ --- annotateStackShow (5 @Int) (fib 20 + throw (ErrorCall "Oh no!")) +-- annotateStackShow (5 @Int) (fib 20 + error "Oh no!") -- @ -- --- Without forcing the result of @(fib 20 + throw (ErrorCall "Oh no!"))@, the computation +-- Without forcing the result of @(fib 20 + error "Oh no!")@, the computation -- will simply return a thunk, and the stack annotation would be popped off the stack. -- Once the thunk is evaluated, the exception is raised, but no stack annotation will be found! --- If we force the result of @(fib 20 + throw (ErrorCall "Oh no!"))@, then the stack +-- If we force the result of @(fib 20 + error "Oh no!")@, then the stack -- annotations remain on the stack, and are displayed in the stack trace. -- -- Naturally, this only holds if no imprecise exceptions are thrown during evaluation of any -- nested value, for example in 'annotateStackShow 5 (Just $ throw (ErrorCall "Oh no!"))', the -- stack trace will not include the value @5@. -- --- See how we preferred @throw (ErrorCall ...)@ over @error@? --- See Note [Pushing annotation frames on 'error'] for why we do this. - --- Note [Pushing annotation frames on 'error'] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- Examples so far have not been using 'error' at all. --- The reason is that 'error' is extraordinarily difficult to use correctly with stack annotation frames. --- See Note [Capturing the backtrace in throw] for a detailed discussion of how 'throw' --- manages to capture 'Backtraces'. --- --- Long story short, 'error' does not do the same thing as 'throw' and is subtly different --- in terms of evaluation, cause it to bypass the stack annotation frames, especially in --- pure code. --- --- However, even in 'IO' code, it is difficult to use 'error' and obtain stack annotation frames --- close to the call site due to the same issue of laziness and backtrace collection. --- --- This means, right now, if you want to reliably capture stack frame annotations, --- in both pure and impure code, prefer 'throw' and 'throwIO' variants over 'error'. -- ---------------------------------------------------------------------------- -- Annotations -- ---------------------------------------------------------------------------- + +-- | A 'String' only annotation with an optional source location. data StringAnnotation where - StringAnnotation :: String -> StringAnnotation + StringAnnotation :: !(Maybe SrcLoc) -> String -> StringAnnotation instance StackAnnotation StringAnnotation where - displayStackAnnotation (StringAnnotation str) = str + displayStackAnnotationShort (StringAnnotation _srcLoc str) = + str + + stackAnnotationSourceLocation (StringAnnotation srcLoc _str) = + srcLoc -- | Use the 'Show' instance of a type to display as the 'StackAnnotation'. data ShowAnnotation where - ShowAnnotation :: forall a . Show a => a -> ShowAnnotation + ShowAnnotation :: forall a . Show a => !(Maybe SrcLoc) -> a -> ShowAnnotation instance StackAnnotation ShowAnnotation where - displayStackAnnotation (ShowAnnotation showAnno) = show showAnno + displayStackAnnotationShort (ShowAnnotation _srcLoc showAnno) = + show showAnno + + stackAnnotationSourceLocation (ShowAnnotation srcLoc _showAnno) = + srcLoc -- | A 'CallStack' stack annotation. +-- +-- Captures the whole 'CallStack'. newtype CallStackAnnotation = CallStackAnnotation CallStack instance Show CallStackAnnotation where @@ -154,9 +144,23 @@ instance Show CallStackAnnotation where -- | Displays the first entry of the 'CallStack' instance StackAnnotation CallStackAnnotation where - displayStackAnnotation (CallStackAnnotation cs) = case getCallStack cs of + stackAnnotationSourceLocation (CallStackAnnotation cs) = + callStackHeadSrcLoc cs + + displayStackAnnotationShort (CallStackAnnotation cs) = + callStackHeadFunctionName cs + +callStackHeadSrcLoc :: CallStack -> Maybe SrcLoc +callStackHeadSrcLoc cs = + case getCallStack cs of + [] -> Nothing + (_, srcLoc):_ -> Just srcLoc + +callStackHeadFunctionName :: CallStack -> String +callStackHeadFunctionName cs = + case getCallStack cs of [] -> "<unknown source location>" - ((fnName,srcLoc):_) -> fnName ++ ", called at " ++ prettySrcLoc srcLoc + (fnName, _):_ -> fnName -- ---------------------------------------------------------------------------- -- Annotate the CallStack with custom data @@ -172,7 +176,7 @@ instance StackAnnotation CallStackAnnotation where -- -- WARNING: forces the evaluation of @b@ to WHNF. {-# NOINLINE annotateStack #-} -annotateStack :: forall a b. (Typeable a, StackAnnotation a) => a -> b -> b +annotateStack :: forall a b. (HasCallStack, Typeable a, StackAnnotation a) => a -> b -> b annotateStack ann b = unsafePerformIO $ annotateStackIO ann (evaluate b) @@ -196,9 +200,9 @@ annotateCallStack b = unsafePerformIO $ withFrozenCallStack $ -- information to stack traces. -- -- WARNING: forces the evaluation of @b@ to WHNF. -annotateStackString :: forall b . String -> b -> b +annotateStackString :: forall b . HasCallStack => String -> b -> b annotateStackString ann = - annotateStack (StringAnnotation ann) + annotateStack (StringAnnotation (callStackHeadSrcLoc ?callStack) ann) -- | @'annotateStackShow' showable b@ annotates the evaluation stack of @b@ -- with the value @showable@. @@ -207,37 +211,36 @@ annotateStackString ann = -- information to stack traces. -- -- WARNING: forces the evaluation of @b@ to WHNF. -annotateStackShow :: forall a b . (Typeable a, Show a) => a -> b -> b +annotateStackShow :: forall a b . (HasCallStack, Typeable a, Show a) => a -> b -> b annotateStackShow ann = - annotateStack (ShowAnnotation ann) + annotateStack (ShowAnnotation (callStackHeadSrcLoc ?callStack) ann) -- | @'annotateStackIO' showable b@ annotates the evaluation stack of @b@ -- with the value @showable@. -- -- When decoding the call stack, the annotation frames can be used to add more -- information to stack traces. -annotateStackIO :: forall a b . (Typeable a, StackAnnotation a) => a -> IO b -> IO b +annotateStackIO :: forall a b . (HasCallStack, Typeable a, StackAnnotation a) => a -> IO b -> IO b annotateStackIO ann (IO act) = IO $ \s -> annotateStack# (SomeStackAnnotation ann) act s -{-# NOINLINE annotateStackIO #-} -- | @'annotateStackStringIO' msg b@ annotates the evaluation stack of @b@ -- with the value @msg@. -- -- When decoding the call stack, the annotation frames can be used to add more -- information to stack traces. -annotateStackStringIO :: forall b . String -> IO b -> IO b +annotateStackStringIO :: forall b . HasCallStack => String -> IO b -> IO b annotateStackStringIO ann = - annotateStackIO (StringAnnotation ann) + annotateStackIO (StringAnnotation (callStackHeadSrcLoc ?callStack) ann) -- | @'annotateStackShowIO' msg b@ annotates the evaluation stack of @b@ -- with the value @msg@. -- -- When decoding the call stack, the annotation frames can be used to add more -- information to stack traces. -annotateStackShowIO :: forall a b . (Show a) => a -> IO b -> IO b +annotateStackShowIO :: forall a b . (HasCallStack, Show a) => a -> IO b -> IO b annotateStackShowIO ann = - annotateStackIO (ShowAnnotation ann) + annotateStackIO (ShowAnnotation (callStackHeadSrcLoc ?callStack) ann) -- | @'annotateCallStackIO' b@ annotates the evaluation stack of @b@ with the -- current 'callstack'. ===================================== libraries/ghc-experimental/tests/Makefile ===================================== @@ -0,0 +1,7 @@ +# This Makefile runs the tests using GHC's testsuite framework. It +# assumes the package is part of a GHC build tree with the testsuite +# installed in ../../../testsuite. + +TOP=../../../testsuite +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk ===================================== libraries/ghc-experimental/tests/all.T ===================================== ===================================== libraries/ghc-experimental/tests/backtraces/Makefile ===================================== @@ -0,0 +1,7 @@ +# This Makefile runs the tests using GHC's testsuite framework. It +# assumes the package is part of a GHC build tree with the testsuite +# installed in ../../../testsuite. + +TOP=../../../../testsuite +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk ===================================== libraries/ghc-experimental/tests/backtraces/T26806a.hs ===================================== @@ -0,0 +1,14 @@ +module Main where + +import GHC.Stack.Annotation.Experimental +import Control.Exception +import Control.Exception.Backtrace + +main :: IO () +main = do + setBacktraceMechanismState IPEBacktrace True + annotateCallStackIO $ do + annotateStackShowIO ([1..4] :: [Int]) $ do + annotateStackStringIO "Lovely annotation" $ do + throwIO $ ErrorCall "Backtrace Test" + ===================================== libraries/ghc-experimental/tests/backtraces/T26806a.stderr ===================================== @@ -0,0 +1,11 @@ +T26806a: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: + +Backtrace Test + +IPE backtrace: + Lovely annotation, called at T26806a.hs:12:7 in main:Main + [1,2,3,4], called at T26806a.hs:11:5 in main:Main + annotateCallStackIO, called at T26806a.hs:10:3 in main:Main +HasCallStack backtrace: + throwIO, called at T26806a.hs:13:9 in main:Main + ===================================== libraries/ghc-experimental/tests/backtraces/T26806b.hs ===================================== @@ -0,0 +1,18 @@ +module Main where + +import GHC.Stack.Annotation.Experimental +import Control.Exception +import Control.Exception.Backtrace + +main :: IO () +main = do + setBacktraceMechanismState IPEBacktrace True + print $ foo 500 + +foo :: Int -> Int +foo n = + annotateCallStack $ + annotateStackShow ([1..4] :: [Int]) $ + annotateStackString "Lovely annotation" $ + throw $ ErrorCall $ "Backtrace Test: " ++ show (n * n * n) + ===================================== libraries/ghc-experimental/tests/backtraces/T26806b.stderr ===================================== @@ -0,0 +1,13 @@ +T26806b: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: + +Backtrace Test: 125000000 + +IPE backtrace: + Lovely annotation, called at T26806b.hs:16:7 in main:Main + [1,2,3,4], called at T26806b.hs:15:5 in main:Main + annotateCallStack, called at T26806b.hs:14:3 in main:Main +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 + ===================================== libraries/ghc-experimental/tests/backtraces/T26806c.hs ===================================== @@ -0,0 +1,18 @@ +module Main where + +import GHC.Stack.Annotation.Experimental +import Control.Exception +import Control.Exception.Backtrace + +main :: IO () +main = do + setBacktraceMechanismState IPEBacktrace True + print $ foo 500 + +foo :: Int -> Int +foo n = + annotateCallStack $ + annotateStackShow ([1..4] :: [Int]) $ + annotateStackString "Lovely annotation" $ + error $ "Backtrace Test: " ++ show (n * n * n) + ===================================== libraries/ghc-experimental/tests/backtraces/T26806c.stderr ===================================== @@ -0,0 +1,11 @@ +T26806c: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: + +Backtrace Test: 125000000 + +IPE backtrace: + Lovely annotation, called at T26806c.hs:16:7 in main:Main + [1,2,3,4], called at T26806c.hs:15:5 in main:Main + annotateCallStack, called at T26806c.hs:14:3 in main:Main +HasCallStack backtrace: + error, called at T26806c.hs:17:9 in main:Main + ===================================== libraries/ghc-experimental/tests/backtraces/all.T ===================================== @@ -0,0 +1,5 @@ +stack_annotation_backtrace_opts = [ when(have_profiling(), extra_ways(['prof'])) , when(js_arch(), skip) , exit_code(1) ] + +test('T26806a', stack_annotation_backtrace_opts, compile_and_run, ['']) +test('T26806b', stack_annotation_backtrace_opts, compile_and_run, ['']) +test('T26806c', stack_annotation_backtrace_opts, compile_and_run, ['']) ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs ===================================== @@ -4,6 +4,7 @@ module GHC.Internal.Stack.Annotation where import GHC.Internal.Base import GHC.Internal.Data.Typeable +import GHC.Internal.Stack (SrcLoc, prettySrcLoc) -- ---------------------------------------------------------------------------- -- StackAnnotation @@ -13,8 +14,38 @@ import GHC.Internal.Data.Typeable -- as the payload of 'AnnFrame' stack frames. -- class StackAnnotation a where + -- | Display a human readable string for the 'StackAnnotation'. + -- + -- This is supposed to be the long version of 'displayStackAnnotationShort' + -- and may contain a source location. + -- + -- If not provided, 'displayStackAnnotation' is derived from 'stackAnnotationSourceLocation' + -- and 'displayStackAnnotationShort'. displayStackAnnotation :: a -> String + -- | Get the 'SrcLoc' of the given 'StackAnnotation'. + -- + -- This is optional, 'SrcLoc' are not strictly required for 'StackAnnotation', but + -- it is still heavily encouarged to provide a 'SrcLoc' for better IPE backtraces. + stackAnnotationSourceLocation :: a -> Maybe SrcLoc + + -- | The description of the StackAnnotation without any metadata such as source locations. + -- + -- Pefer implementing 'displayStackAnnotationShort' over 'displayStackAnnotation'. + displayStackAnnotationShort :: a -> String + + {-# MINIMAL displayStackAnnotation | displayStackAnnotationShort #-} + + displayStackAnnotation ann = + displayStackAnnotationShort ann + ++ case stackAnnotationSourceLocation ann of + Nothing -> "" + Just srcLoc -> ", called at " ++ prettySrcLoc srcLoc + + stackAnnotationSourceLocation _ann = Nothing + + displayStackAnnotationShort = displayStackAnnotation + -- ---------------------------------------------------------------------------- -- Annotations -- ---------------------------------------------------------------------------- @@ -28,4 +59,11 @@ data SomeStackAnnotation where SomeStackAnnotation :: forall a. (Typeable a, StackAnnotation a) => a -> SomeStackAnnotation instance StackAnnotation SomeStackAnnotation where - displayStackAnnotation (SomeStackAnnotation a) = displayStackAnnotation a + displayStackAnnotation (SomeStackAnnotation a) = + displayStackAnnotation a + + stackAnnotationSourceLocation (SomeStackAnnotation a) = + stackAnnotationSourceLocation a + + displayStackAnnotationShort (SomeStackAnnotation a) = + displayStackAnnotationShort a ===================================== libraries/ghc-internal/tests/stack-annotation/ann_frame001.stdout ===================================== @@ -1,12 +1,12 @@ Stack annotations: -- (2,3) +- (2,3), called at ann_frame001.hs:5:13 in main:Main 47 Stack annotations: -- "bar" -- "foo" -- "tailCallEx" +- "bar", called at ann_frame001.hs:23:9 in main:Main +- "foo", called at ann_frame001.hs:21:11 in main:Main +- "tailCallEx", called at ann_frame001.hs:17:18 in main:Main Stack annotations: -- "bar" -- "foo" -- "tailCallEx" +- "bar", called at ann_frame001.hs:23:9 in main:Main +- "foo", called at ann_frame001.hs:21:11 in main:Main +- "tailCallEx", called at ann_frame001.hs:17:18 in main:Main 40 ===================================== libraries/ghc-internal/tests/stack-annotation/ann_frame002.stdout ===================================== @@ -7,5 +7,5 @@ Finish some work Some more work in bar 17711 Stack annotations: -- bar +- bar, called at ann_frame002.hs:23:29 in main:Main - annotateCallStackIO, called at ann_frame002.hs:23:7 in main:Main ===================================== libraries/ghc-internal/tests/stack-annotation/ann_frame003.stdout ===================================== @@ -1,6 +1,6 @@ 47 Stack annotations: -- "bar" -- "foo" -- "tailCallEx" +- "bar", called at ann_frame003.hs:25:9 in main:Main +- "foo", called at ann_frame003.hs:21:11 in main:Main +- "tailCallEx", called at ann_frame003.hs:16:18 in main:Main 40 ===================================== libraries/ghc-internal/tests/stack-annotation/ann_frame004.stdout ===================================== @@ -13,5 +13,5 @@ Stack annotations: - annotateCallStack, called at ann_frame004.hs:21:17 in main:Main - annotateCallStack, called at ann_frame004.hs:21:17 in main:Main - annotateCallStack, called at ann_frame004.hs:13:10 in main:Main -- bar +- bar, called at ann_frame004.hs:12:29 in main:Main - annotateCallStackIO, called at ann_frame004.hs:12:7 in main:Main ===================================== libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout ===================================== @@ -2,9 +2,9 @@ Caught exception: SimpleBoom Exception context: - IPE backtrace: -- throwIO SimpleBoom -- raising action -- catch site for throwIO SimpleBoom +- throwIO SimpleBoom, called at ann_frame005.hs:33:5 in main:Main +- raising action, called at ann_frame005.hs:32:3 in main:Main +- catch site for throwIO SimpleBoom, called at ann_frame005.hs:27:5 in main:Main - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main - HasCallStack backtrace: - throwIO, called at ann_frame005.hs:34:7 in main:Main @@ -13,9 +13,9 @@ Handler annotation not present in context Caught exception: Prelude.undefined Exception context: - IPE backtrace: -- undefined thunk -- raising undefined action -- catch site for undefined +- undefined thunk, called at ann_frame005.hs:41:9 in main:Main +- raising undefined action, called at ann_frame005.hs:38:3 in main:Main +- catch site for undefined, called at ann_frame005.hs:27:5 in main:Main - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main - HasCallStack backtrace: - undefined, called at ann_frame005.hs:41:48 in main:Main @@ -24,9 +24,9 @@ Handler annotation not present in context Caught exception: error from annotateStackString Exception context: - IPE backtrace: -- error thunk -- raising error action -- catch site for error +- error thunk, called at ann_frame005.hs:48:9 in main:Main +- raising error action, called at ann_frame005.hs:45:3 in main:Main +- catch site for error, called at ann_frame005.hs:27:5 in main:Main - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main - HasCallStack backtrace: - error, called at ann_frame005.hs:48:44 in main:Main @@ -35,8 +35,8 @@ Handler annotation not present in context Caught exception: SimpleBoom Exception context: - IPE backtrace: -- raising throwSTM action -- catch site for throwSTM +- raising throwSTM action, called at ann_frame005.hs:52:3 in main:Main +- catch site for throwSTM, called at ann_frame005.hs:27:5 in main:Main - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main - HasCallStack backtrace: - collectExceptionAnnotation, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:170:37 in ghc-internal:GHC.Internal.Exception ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout ===================================== @@ -6499,25 +6499,27 @@ module GHC.Stack.Annotation.Experimental where newtype CallStackAnnotation = CallStackAnnotation GHC.Internal.Stack.Types.CallStack type ShowAnnotation :: * data ShowAnnotation where - ShowAnnotation :: forall a. GHC.Internal.Show.Show a => a -> ShowAnnotation + ShowAnnotation :: forall a. GHC.Internal.Show.Show a => !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> a -> ShowAnnotation type SomeStackAnnotation :: * data SomeStackAnnotation where SomeStackAnnotation :: forall a. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> SomeStackAnnotation type StackAnnotation :: * -> Constraint class StackAnnotation a where displayStackAnnotation :: a -> GHC.Internal.Base.String - {-# MINIMAL displayStackAnnotation #-} + stackAnnotationSourceLocation :: a -> GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc + displayStackAnnotationShort :: a -> GHC.Internal.Base.String + {-# MINIMAL displayStackAnnotation | displayStackAnnotationShort #-} type StringAnnotation :: * data StringAnnotation where - StringAnnotation :: GHC.Internal.Base.String -> StringAnnotation + StringAnnotation :: !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> GHC.Internal.Base.String -> StringAnnotation annotateCallStack :: forall b. GHC.Internal.Stack.Types.HasCallStack => b -> b annotateCallStackIO :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Types.IO a -> GHC.Internal.Types.IO a - annotateStack :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b - annotateStackIO :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b - annotateStackShow :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b - annotateStackShowIO :: forall a b. GHC.Internal.Show.Show a => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b - annotateStackString :: forall b. GHC.Internal.Base.String -> b -> b - annotateStackStringIO :: forall b. GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b + annotateStack :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b + annotateStackIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b + annotateStackShow :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b + annotateStackShowIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, GHC.Internal.Show.Show a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b + annotateStackString :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> b -> b + annotateStackStringIO :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b module GHC.Stats.Experimental where -- Safety: Safe ===================================== testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32 ===================================== @@ -6502,25 +6502,27 @@ module GHC.Stack.Annotation.Experimental where newtype CallStackAnnotation = CallStackAnnotation GHC.Internal.Stack.Types.CallStack type ShowAnnotation :: * data ShowAnnotation where - ShowAnnotation :: forall a. GHC.Internal.Show.Show a => a -> ShowAnnotation + ShowAnnotation :: forall a. GHC.Internal.Show.Show a => !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> a -> ShowAnnotation type SomeStackAnnotation :: * data SomeStackAnnotation where SomeStackAnnotation :: forall a. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> SomeStackAnnotation type StackAnnotation :: * -> Constraint class StackAnnotation a where displayStackAnnotation :: a -> GHC.Internal.Base.String - {-# MINIMAL displayStackAnnotation #-} + stackAnnotationSourceLocation :: a -> GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc + displayStackAnnotationShort :: a -> GHC.Internal.Base.String + {-# MINIMAL displayStackAnnotation | displayStackAnnotationShort #-} type StringAnnotation :: * data StringAnnotation where - StringAnnotation :: GHC.Internal.Base.String -> StringAnnotation + StringAnnotation :: !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> GHC.Internal.Base.String -> StringAnnotation annotateCallStack :: forall b. GHC.Internal.Stack.Types.HasCallStack => b -> b annotateCallStackIO :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Types.IO a -> GHC.Internal.Types.IO a - annotateStack :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b - annotateStackIO :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b - annotateStackShow :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b - annotateStackShowIO :: forall a b. GHC.Internal.Show.Show a => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b - annotateStackString :: forall b. GHC.Internal.Base.String -> b -> b - annotateStackStringIO :: forall b. GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b + annotateStack :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b + annotateStackIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b + annotateStackShow :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b + annotateStackShowIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, GHC.Internal.Show.Show a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b + annotateStackString :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> b -> b + annotateStackStringIO :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b module GHC.Stats.Experimental where -- Safety: Safe View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d40ddcc09a573c99485ee110c7db1236... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d40ddcc09a573c99485ee110c7db1236... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Hannes Siebenhandl (@fendor)