never executed always true always false
1 -- | Haskell Program Coverage (HPC) support
2 module GHC.Types.HpcInfo
3 ( HpcInfo (..)
4 , AnyHpcUsage
5 , emptyHpcInfo
6 , isHpcUsed
7 )
8 where
9
10 import GHC.Prelude
11
12 -- | Information about a modules use of Haskell Program Coverage
13 data HpcInfo
14 = HpcInfo
15 { hpcInfoTickCount :: Int
16 , hpcInfoHash :: Int
17 }
18 | NoHpcInfo
19 { hpcUsed :: AnyHpcUsage -- ^ Is hpc used anywhere on the module \*tree\*?
20 }
21
22 -- | This is used to signal if one of my imports used HPC instrumentation
23 -- even if there is no module-local HPC usage
24 type AnyHpcUsage = Bool
25
26 emptyHpcInfo :: AnyHpcUsage -> HpcInfo
27 emptyHpcInfo = NoHpcInfo
28
29 -- | Find out if HPC is used by this module or any of the modules
30 -- it depends upon
31 isHpcUsed :: HpcInfo -> AnyHpcUsage
32 isHpcUsed (HpcInfo {}) = True
33 isHpcUsed (NoHpcInfo { hpcUsed = used }) = used
34