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

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.unsafeGlobalD

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 use

Re: Unexpected ambiguity in a seemingly valid Haskell 2010 program

2012-11-11 Thread Erik Hesselink
That makes sense: MonomorphismRestriction makes bindings without parameters monomorphic, and MonoLocalBinds makes local bindings monomorphic. So either one will make this binding monomorphic. Only when both are off does it become polymorphic and does the error occur. Erik On Sun, Nov 11, 2012 at

Re: Unexpected ambiguity in a seemingly valid Haskell 2010 program

2012-11-11 Thread Roman Cheplyaka
Right. What I meant is that with -XMonomorphismRestriction, it compiles with with both -XMonoLocalBinds and -XNoMonoLocalBinds. That means that MonoLocalBinds can not be solely responsible for this behaviour. Anyway, I just noticed that a very similar example (using Read) is described in the Hask

Re: Unexpected ambiguity in a seemingly valid Haskell 2010 program

2012-11-11 Thread Erik Hesselink
That's strange. Here, it only fails with both NoMonomorphismRestriction and NoMonoLocalBinds (which makes sense). I've tested on 7.4.1 and 7.6.1. Erik On Sun, Nov 11, 2012 at 3:54 PM, Roman Cheplyaka wrote: > Apparently not — the code comilers with any of -XNoMonoLocalBinds and > -XMonoLocalBi

Re: Unexpected ambiguity in a seemingly valid Haskell 2010 program

2012-11-11 Thread Roman Cheplyaka
Apparently not — the code comilers with any of -XNoMonoLocalBinds and -XMonoLocalBinds, but not with -XNoMonomorphismRestriction. * wagne...@seas.upenn.edu [2012-11-09 14:07:59-0500] > It's possible that the below blog post is related. > ~d > > http://hackage.haskell.org/trac/ghc/blog/LetGeneral