tracing Haskell programs

Mikael Brockman phubuh at phubuh.org
Mon Oct 20 16:29:00 EDT 2003


wvasconc at csd.abdn.ac.uk writes:

> Hi folk
> 
> Is there a way to follow the "execution" of a Haskell program? What I mean here
> is a way to see which function definition is being used at any moment, and how
> the execution control moves around a script file.
> 
> If this is a preposterous question, just tell me nicely and I will go away!
> 
> Oh, and if this has been discussed before, please tell me where and I will chase
> it up.
> 
> Thanks!

It is slightly preposterous; since Haskell programs are referentially
transparent, simply looking at the order in which the program is run
is confusing -- there are no side effects, so the compiler might
generate code whose order of execution is far from the expected.

Nevertheless, there are excellent debugging tools for Haskell:

  * Hat   <http://www.cs.york.ac.uk/fp/hat/>
  * Hood  <http://www.haskell.org/hood>
  * GHood <http://www.cs.ukc.ac.uk/people/staff/cr3/toolbox/haskell/>

Although they don't work like, say GDB, I find them more intuitive,
since they in the spirit of functional programming focus on /what/ a
function calculates instead of /how/.

There's a more exhaustive list at
<http://www.haskell.org/libraries/#tracing>. Knock yourself out!

---
Mikael Brockman
phubuh at phubuh.org



More information about the Haskell-Cafe mailing list