Haskell program coverage

155 views Asked by At

I'm trying to use the ghc -fhpc command in order to create a .tix file, but after I enter the command ghc -fhpc filename, nothing appears.

What should I do?

1

There are 1 answers

5
Thomas M. DuBuisson On

You must execute the program. HPC shows the coverage of a particular run, it isn't a static analysis that occurs at compile time.

EDIT

For example. Does this not work for you?

% cat x.hs
main = getChar >>= print
% ghc -fforce-recomp -fhpc x.hs
[1 of 1] Compiling Main             ( x.hs, x.o )
Linking x ...
% ./x
x
'x'
% ls x.tix
x.tix

If the above doesn't work then you have a tooling issue.

EDIT 2:

If your program isn't terminating normally then the .tix file might not be getting written. You need a normal termination and not some sort of segfaulted or otherwise-aborted run.