Wolfgang Jeltsch pushed to branch wip/jeltsch/ghc-9-14-building-base at Glasgow Haskell Compiler / GHC
Commits:
-
952f9965
by Wolfgang Jeltsch at 2026-08-12T16:33:25+03:00
2 changed files:
Changes:
| 1 | 1 | {-# LANGUAGE Safe #-}
|
| 2 | 2 | |
| 3 | +{-# LANGUAGE RankNTypes #-}
|
|
| 4 | +{-# LANGUAGE ImplicitParams #-}
|
|
| 5 | + |
|
| 3 | 6 | -- |
|
| 4 | 7 | --
|
| 5 | 8 | -- Module : GHC.Stack
|
| ... | ... | @@ -51,3 +54,20 @@ module GHC.Stack |
| 51 | 54 | ) where
|
| 52 | 55 | |
| 53 | 56 | import GHC.Internal.Stack
|
| 57 | + |
|
| 58 | +-- | Explicitly bring the empty call stack into scope.
|
|
| 59 | +--
|
|
| 60 | +-- Mostly useful for silencing warnings generated by @-Wdefaulted-callstack@ in
|
|
| 61 | +-- places such as:
|
|
| 62 | +--
|
|
| 63 | +-- - The body of a class method in an instance of an externally defined type
|
|
| 64 | +-- class whose type signature doesn't contain a 'HasCallStack' constraint.
|
|
| 65 | +--
|
|
| 66 | +-- - The body of the @main@ function.
|
|
| 67 | +--
|
|
| 68 | +-- @since 4.24.0.0
|
|
| 69 | +withEmptyCallStack :: (HasCallStack => a) -> a
|
|
| 70 | +withEmptyCallStack do_this =
|
|
| 71 | + -- See Note [Warn about defaulted CallStacks]
|
|
| 72 | + let ?callStack = emptyCallStack
|
|
| 73 | + in do_this |
| ... | ... | @@ -29,7 +29,7 @@ module GHC.Internal.Stack ( |
| 29 | 29 | -- * HasCallStack call stacks
|
| 30 | 30 | CallStack, HasCallStack, callStack, emptyCallStack, freezeCallStack,
|
| 31 | 31 | fromCallSiteList, getCallStack, popCallStack,
|
| 32 | - pushCallStack, withFrozenCallStack, withEmptyCallStack,
|
|
| 32 | + pushCallStack, withFrozenCallStack,
|
|
| 33 | 33 | prettyCallStackLines, prettyCallStack,
|
| 34 | 34 | |
| 35 | 35 | -- * Source locations
|
| ... | ... | @@ -105,23 +105,6 @@ withFrozenCallStack do_this = |
| 105 | 105 | let ?callStack = freezeCallStack (popCallStack callStack)
|
| 106 | 106 | in do_this
|
| 107 | 107 | |
| 108 | --- | Explicitly bring the empty call stack into scope.
|
|
| 109 | ---
|
|
| 110 | --- Mostly useful for silencing warnings generated by @-Wdefaulted-callstack@ in
|
|
| 111 | --- places such as:
|
|
| 112 | ---
|
|
| 113 | --- - The body of a class method in an instance of an externally defined type
|
|
| 114 | --- class whose type signature doesn't contain a 'HasCallStack' constraint.
|
|
| 115 | ---
|
|
| 116 | --- - The body of the @main@ function.
|
|
| 117 | ---
|
|
| 118 | --- @since 4.24.0.0
|
|
| 119 | -withEmptyCallStack :: (HasCallStack => a) -> a
|
|
| 120 | -withEmptyCallStack do_this =
|
|
| 121 | - -- See Note [Warn about defaulted CallStacks]
|
|
| 122 | - let ?callStack = emptyCallStack
|
|
| 123 | - in do_this
|
|
| 124 | - |
|
| 125 | 108 | -- prettySrcLoc and prettyCallStack are defined here to avoid hs-boot
|
| 126 | 109 | -- files. See Note [Definition of CallStack]
|
| 127 | 110 |