If you use GHC’s -fhpc
flag to generate coverage reports, do you rely on the fact that running the executable multiple times accumulates the coverage over all runs? This is the behaviour currently implemented by default, and which I propose to change in this GHC proposal: Change semantics of `-fhpc` to not accumulate data over multiple runs by BinderDavid · Pull Request #612 · ghc-proposals/ghc-proposals · GitHub
Here is an example to illustrate the behaviour:
> cat Example.hs
module Main where
main = print "hello"
> ghc -fhpc Example.hs
[1 of 2] Compiling Main ( Example.hs, Example.o )
[2 of 2] Linking Example
> ./Example
"hello"
> cat Example.tix
Tix [ TixModule "Main" 2243069736 3 [1,1,1]]
> ./Example
"hello"
> cat Example.tix
Tix [ TixModule "Main" 2243069736 3 [2,2,2]]
I have been bitten by this behaviour multiple times now, and propose to change it so that you have to do any accumulation of multiple runs yourself. But I would like to know whether anyone is relying on this behaviour, or if you are surprised, as I was when I discovered this.