0

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?

Zoe
  • 27,060
  • 21
  • 118
  • 148
  • 1
    try addin `--make -fforce-recomp` to the compiler flags – jev Feb 15 '16 at 22:14
  • i tried, but still nothing appear. i compiled the program like this "ghc filename.hs" and it compiled without any problem. After i did " ghc -fhpc --make -fforce-recomp filename". Did i something wrong? – Vitor Dias Feb 15 '16 at 22:44
  • If Cabal is used to generate the coverage report, there is a flag: ```--test-keep-tix-files keep .tix files for HPC between test runs``` – Peter Becich May 25 '22 at 07:33

1 Answers1

3

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.

Thomas M. DuBuisson
  • 64,245
  • 7
  • 109
  • 166