From 126b4125d95f7e4d272a9307cb8b634b11bd337f Mon Sep 17 00:00:00 2001 From: "klebinger.andreas@gmx.at" Date: Wed, 16 May 2018 12:11:27 -0400 Subject: 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 --- compiler/utils/Outputable.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/utils/Outputable.hs') 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 -- cgit v1.2.1