[Haskell] modern language design, stone age tools

Simon Marlow simonmar at microsoft.com
Thu Jun 24 05:01:16 EDT 2004


On 23 June 2004 18:39, Fergus Henderson wrote:

> On 23-Jun-2004, MR K P SCHUPKE <k.schupke at imperial.ac.uk> wrote:
>> This may not be the right answer to the question (which is of
>> course lets write a debugger) - But I have never used a debugger,
>> and find them more or less the most unfriendly and useless things
> 
> So how do you debug problems like "Prelude.head: empty list"
> in large programs?

The two most useful techniques, both have which have already been
suggested by others are:

  1.  Compile with -prof -auto-all and run with +RTS -xc.

  2.  Use the mapException trick to annotate exceptions as they
      travel up the stack (see Alastair Reid's message).

(1) doesn't work that well, as you noticed.  For example, sometimes the
exception will stop at a CAF, due to the way cost centres work in GHC.
I'd really like us to do better here - keeping track of the call stack
in a lazy higher-order language has turned out to be surprisingly
tricky.

(2) requires that you add lots of annotations to your code, so it's not
entirely satisfactory for that reason.

Even if we had an interactive debugger, getting a good call stack is
still going to be a hard problem.

Cheers,
	Simon


More information about the Haskell mailing list