[Haskell-cafe] Re: Problems with Haskell Program Coverage

Dominic Steinitz dominic at steinitz.org
Sat Apr 25 04:23:51 EDT 2009

Malcolm Wallace <Malcolm.Wallace <at> cs.york.ac.uk> writes:

> Dominic Steinitz <dominic.steinitz <at> blueyonder.co.uk> wrote:
> > I want to use hpc to check that the ASN.1 library tests cover all the
> > code.  When I run it with a set of tests that I *know* don't test
> > certain things, it  reports that they have been covered i.e. there are
> > not coloured in the markup  that hpc produces. I would have expected a
> > lot of yellow.
> The record of coverage is cumulative across multiple runs.  Is it
> possible that you did not remove an old .tix file before running the
> tests?

Thanks for your reply I was beginning to worry I might be the only person trying
to use this.

I've done a bit of investigation and it seems there are at least two problems:

1. I have literate haskell files (.lhs).

2. Even if I run them through the pre-processor (ghc -E) they still don't work 
but if I manually remove these lines (which seem to get inserted by the

{-# LINE 1 "ASNTYPE.lhs" #-}
#line 1 "ASNTYPE.lhs"

then it does actually work.

It looks like a bug to me. I guess I should report it on the ghc trac.

I still have a problem with another project which doesn't use literate haskell
but does require the use of -cpp and has got #ifdef's. I haven't got to the
bottom of it yet but I'm suspicious that lines starting with # cause hpc to

It's strange that hpc should behave like this as I would have thought it
wouldn't care about hs / lhs and # as ghc would have done some of its standard
processing before hpc got engaged.



More information about the Haskell-Cafe mailing list