[Haskell-cafe] Trouble with Debug.Trace when using a library

Thomas Horstmeyer horstmey at Mathematik.Uni-Marburg.de
Wed May 15 11:18:20 CEST 2013


Perhaps x is evaluated earlier than you think, i.e. before the trace 
(due to some strictness analysis?). But this is a just a guess.

I usually use trace outermost in my expression, not within a let. I 
never had a problem with it:


fA :: SomeInput -> SomeResult
fA a =  trace ("Entering fA") $ f a


-- or even:
fA a = trace ("Entering fA") $
        f a


HTH
Thomas


Am 14.05.2013 15:03, schrieb hanjoosten:
> My project is split in two packages, A and B, where B uses A. All together,
> there are about 100 haskell modules.
> Currently, there seems to be a loop somewere, that only seems to occur when
> working with rather large datastructures. I use trace (from Debug.Trace) to
> see what exactly is going on.
> As long as I trace functions from B, trace works as expected. However, at
> some point I need to trace into functions supplied by package A.
>
> In package A I have a function like this: (I have simplified the function)
>
> fA :: SomeInput -> SomeResult
> fA a =  let x = f a
>            in trace ("Entering fA") x
>
> (The function f is defined in package A)
>
> In package B, I have a function like this:
>
> fB :: SomeInput -> SomeResult
> fB a = let x = fA a
>           in trace ( "Entering fB") x
>
> At runtime, I get the message
> Entering fB
>
> and then nothing more. a lot of cpu is used, but no more output.
>
> I have made some wrappers like the ones above. As long as they are in the
> same package, trace works fine. However, when entering a function from the
> other package, there is no more debug output.
>
> This is very anoying. Anyone some suggestions? Is this a bug?
>
> I use the haskell platform 12.4.0.0 on a windows 7 machine.
>
>
>
>
> --
> View this message in context: http://haskell.1045720.n5.nabble.com/Trouble-with-Debug-Trace-when-using-a-library-tp5730157.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list