On Mon, Nov 12, 2012 at 5:15 AM, Richard Eisenberg <eir@cis.upenn.edu> wrote:
>
> I've recently used the conveniently-typed (pprTrace :: String -> SDoc -> a -> a) for this purpose. You have to compile with -DDEBUG, but it works great.
>
> Richard

To use pprTrace you don't actually need to compile with -DDEBUG, it only checks if -dno-debug-output has been specified on the command line:
http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/src/Outputable.html#pprTrace
http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/src/StaticFlags.html#opt_NoDebugOutput

Cheers,
Michal