summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
authorklebinger.andreas@gmx.at <klebinger.andreas@gmx.at>2018-05-16 12:11:27 -0400
committerBen Gamari <ben@smart-cactus.org>2018-05-16 12:58:29 -0400
commit126b4125d95f7e4d272a9307cb8b634b11bd337f (patch)
tree9f2733730d6e9bc8f6e2fcf5eb5738a006bc1184 /compiler/utils
parent3310f7f14c0ba34a57fe5a77f47d2a66fe838a43 (diff)
downloadhaskell-126b4125d95f7e4d272a9307cb8b634b11bd337f.tar.gz
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
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Outputable.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index e43573499c..2b89162296 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