Hat

Frequently Asked Questions


Why do you call it a tracer rather than a debugger?

The word debugger suggests: firstly that there is a fault to be found; and secondly, that the tool will fix it. In actual fact, the tracer is just a tool for observing what happened in any particular program run. You can use it to find the cause of a fault, but equally, you can use it simply to aid your understanding of a correct program. While the tracer will help you to find bugs, it cannot find them for you. And once the bug is found, you must fix it, the tracer cannot!

Why did you not implement a conventional tracer/debugger as they are well known for imperative languages?

Conventional tracers (debuggers) for imperative languages allow the user to step through the program computation, stop at given points and examine variable contents. In our opinion this tracing method is unsuitable for a lazy functional language such as Haskell, because its evaluation order is complex, function arguments are usually unwieldy large unevaluated expressions, and generally computation details do not match the user's high-level view of functions mapping values to values. Also the stack used by the Haskell runtime system does not resemble the stack of function calls used by runtime systems of strict languages.

However, the trace file written by the traced program contains all information in the order of lazy evaluation. It is possible to write a viewing tool that admits single stepping through a lazy computation.

How much does tracing cost me in time and space?

Currently a traced program runs about 50 times slower than its untraced counterpart. We are working on reducing this factor. As a rule of thumb, a reduction step produces about 40 bytes in the trace file. So trace files can easily grow to tens and hundreds of megabytes. However, you can name some modules of your program as trusted, so that their reductions are not recorded in the trace.

I have trouble compiling my program for tracing.

Hat nearly (but not yet fully) covers the complete Haskell 98 language and its libraries. It also supports only a few language extensions. Check the Hat Feature Summary to see exactly which parts of the language are missing, and when you can expect them to be added.

Even on a very simple program, the tracing compiler complains about dPat: no match.

This not-very-informative message actually means you have used an (n+k) pattern in a definition. The tracing compiler doesn't yet handle (n+k) patterns correctly. We hope to fix this soon, but in the meantime you will have to rewrite your program by hand to avoid this construct.


The latest updates to these pages are available on the WWW from http://www.cs.york.ac.uk/fp/hat/

This page last modified: 21 May 2001
York Functional Programming Group