Re: How to use `trace` while debuging GHC

2012-11-12 Thread Michal Terepeta
On Mon, Nov 12, 2012 at 5:15 AM, Richard Eisenberg 
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
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: How to use `trace` while debuging GHC

2012-11-11 Thread Richard Eisenberg
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

On Nov 11, 2012, at 8:36 PM, Ian Lynagh  wrote:

> On Sun, Nov 11, 2012 at 05:24:06PM -0800, Iavor Diatchki wrote:
>> 
>> There used to be a value called `tracingDynFlags` that I could use to dump
>> values, but it has disappeared...  Did it get moved somewhere, or is there
>> a better way to get the same effect?
> 
> There is now StaticFlags.unsafeGlobalDynFlags.
> 
> 
> Thanks
> Ian
> 
> 
> ___
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: How to use `trace` while debuging GHC

2012-11-11 Thread Ian Lynagh
On Sun, Nov 11, 2012 at 05:24:06PM -0800, Iavor Diatchki wrote:
> 
> There used to be a value called `tracingDynFlags` that I could use to dump
> values, but it has disappeared...  Did it get moved somewhere, or is there
> a better way to get the same effect?

There is now StaticFlags.unsafeGlobalDynFlags.


Thanks
Ian


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


How to use `trace` while debuging GHC

2012-11-11 Thread Iavor Diatchki
Hello,

While working on GHC sometimes I find it useful to dump the values of
intermediate expressions, perhaps in the middle of pure code, using a
combination of `trace` and `ppr`.  The issue is that `ppr` returns an
`SDoc`, and to turn an `SDoc` into a `String`, I need some `DynFlags`.

There used to be a value called `tracingDynFlags` that I could use to dump
values, but it has disappeared...  Did it get moved somewhere, or is there
a better way to get the same effect?

-Iavor
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users