[commit: ghc] master: Add pprTraceM to Outputable as analog to traceM. (126b412)
git at git.haskell.org
git at git.haskell.org
Wed May 16 19:40:57 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/126b4125d95f7e4d272a9307cb8b634b11bd337f/ghc
>---------------------------------------------------------------
commit 126b4125d95f7e4d272a9307cb8b634b11bd337f
Author: klebinger.andreas at gmx.at <klebinger.andreas at gmx.at>
Date: Wed May 16 12:11:27 2018 -0400
Add pprTraceM to Outputable as analog to traceM.
Test Plan: ci, using it in monadic code.
Reviewers: bgamari, mpickering
Reviewed By: mpickering
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4697
>---------------------------------------------------------------
126b4125d95f7e4d272a9307cb8b634b11bd337f
compiler/utils/Outputable.hs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index e435734..2b89162 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -82,7 +82,7 @@ module Outputable (
-- * Error handling and debugging utilities
pprPanic, pprSorry, assertPprPanic, pprPgmError,
pprTrace, pprTraceDebug, pprTraceIt, warnPprTrace, pprSTrace,
- pprTraceException,
+ pprTraceException, pprTraceM,
trace, pgmError, panic, sorry, assertPanic,
pprDebugAndThen, callStackDoc,
) where
@@ -1182,6 +1182,9 @@ pprTrace str doc x
| otherwise =
pprDebugAndThen unsafeGlobalDynFlags trace (text str) doc x
+pprTraceM :: Applicative f => String -> SDoc -> f ()
+pprTraceM str doc = pprTrace str doc (pure ())
+
-- | @pprTraceIt desc x@ is equivalent to @pprTrace desc (ppr x) x@
pprTraceIt :: Outputable a => String -> a -> a
pprTraceIt desc x = pprTrace desc (ppr x) x
More information about the ghc-commits
mailing list