Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
4bf040c6
by sheaf at 2026-04-05T14:56:29-04:00
1 changed file:
Changes:
| 1 | 1 | -- | Tracing utilities
|
| 2 | 2 | module GHC.Utils.Trace
|
| 3 | 3 | ( pprTrace
|
| 4 | + , pprTrace_
|
|
| 4 | 5 | , pprTraceM
|
| 5 | 6 | , pprTraceDebug
|
| 6 | 7 | , pprTraceIt
|
| ... | ... | @@ -43,6 +44,22 @@ pprTrace str doc x |
| 43 | 44 | | unsafeHasNoDebugOutput = x
|
| 44 | 45 | | otherwise = pprDebugAndThen traceSDocContext trace (text str) doc x
|
| 45 | 46 | |
| 47 | +-- | A version of 'pprTrace' that is useful for quick debugging:
|
|
| 48 | +--
|
|
| 49 | +-- @
|
|
| 50 | +-- fooBar x y
|
|
| 51 | +-- | cond = body1
|
|
| 52 | +-- | otherwise = body2
|
|
| 53 | +-- where
|
|
| 54 | +-- !_ = pprTrace_ "fooBar" $
|
|
| 55 | +-- vcat [ text "x:" <+> ppr x
|
|
| 56 | +-- , text "y:" <+> ppr y
|
|
| 57 | +-- , text "cond:" <+> ppr cond
|
|
| 58 | +-- ]
|
|
| 59 | +-- @
|
|
| 60 | +pprTrace_ :: String -> SDoc -> ()
|
|
| 61 | +pprTrace_ str doc = pprTrace str doc ()
|
|
| 62 | + |
|
| 46 | 63 | pprTraceM :: Applicative f => String -> SDoc -> f ()
|
| 47 | 64 | pprTraceM str doc = pprTrace str doc (pure ())
|
| 48 | 65 |