I have the start of a haskell application and want to see how the building tools behave. One of the things I would like to see is Haskell coverage reports via hpc (Haskell Program Coverage β I did not find this tag, therefore hpc points to high-performance calculations on the note side).
Structure of my application
Main src/ ModuleA ModuleB tests/ ModuleBTest
I have unit tests for module B and I run these unit tests through the cabal test. I used to configure cabal to output hpc data via
cabal configure --ghc-options=-fhpc --enable-tests
Then i build and test
cabal build cabal test unit-tests (that the name of the test suite in the cabal file)
and I really see the report, and everything looks good. However, module A is not transferred from module B, it refers only to Main. I have no tests for the Main module.
The thing is, I was expecting to see the moduleA popup in the hpc output highlighted in yellow and really waving to me that there are no tests for this module, but that doesn't seem to be the case. I noticed that the .mix files are created for this βunusedβ module, so I suspect that the build step went fine, but it was wrong at the cache testing stage.
If I go through ghci and I compile unit tests, and module A is explicitly in the list of modules to compile, then I get hpc to show me that this module has no tests at all. Therefore, I suspect that the cable is optimizing this module (for example, "not used"), but I really do not see how and where.
Now I understand that this may not be the real situation, since moduleA refers only to the main method, module B does not refer to module A, and I do not test the main module (for now), but still I would feel much better if at least it would appear in the coverage of the program as a hole in my tests the size of a battleship. Does anyone have an idea?
Note. I understand that my question can be as follows: "How can I say that bondage does not need to optimize unused modules?" but I wanted to introduce a complete problem.
Kasper