Haskell code coverage tool?

Simon Marlow simonmar@microsoft.com
Fri, 25 Oct 2002 09:57:29 +0100

> Is anyone aware of a code-coverage tool for Haskell, specifically one=20
> that works/uses the ghc?
> I've been trying to use the profiling information for my purpose but=20
> would much prefer there to be a specialized tool that:
> (i) provides "line" coverage information in the sense that it=20
> distinguishes e.g. case handling and if/then/else.
> (ii) projects the coverage information onto the source code

There isn't such a tool that I know of.  Building one would make a good
student project, though!

The profiling system could be persuaded to do coarse code coverage
analysis without too much difficulty.  With -auto-all we get cost
centres attached to every top-level function, and it's simply a matter
of comparing the full set of cost centres against the profile generated
by running the program.  The complete set of cost centres could be
obtained in a hacky way by examining object files.