[Haskell-cafe] hpc - ignore some expressions

Ozgur Akgun ozgurakgun at gmail.com
Mon Feb 23 10:36:59 UTC 2015


I am generating code coverage reports using hpc, it works great.

The reports would be much more helpful if I could somehow tell hpc to treat
certain expressions as "covered" though.

As an example, let's think of "impossible" cases of a function.

f x | check x = result x
    | otherwise = error "impossible"

I know there are techniques to get rid of (or minimise the number of) the
impossible cases. I also can see how this information can be relevant, i.e.
seeing whether `check` always holds or not in the report.

However, at least for one version of the report, I want the error call like
the above example to be treated as covered. Or maybe a different colour
could be used to annotate "ignored"?

Did anyone need/want anything like this? Is it possible?

My guess is that this is somewhat possible using manually generated .tix
files and merging them with the .tix file that is generated in the usual
way. However this feels too adhoc, fragile and seems to be too much effort
to reach a simple goal.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150223/62783b03/attachment.html>

More information about the Haskell-Cafe mailing list