Skip to content

HPC: do notation marks () as non-covered

With this Main.hs, the "()" in "pure ()" is marked by HPC as a non-covered expression:

foo :: IO ()
foo = do
   _ <- putStrLn "Unimportant string"
   pure ()

main :: IO ()
main = do
   foo
   putStrLn "Unimportant #2"

Repro:

  • ghc -fhpc Main.hs
  • ./Main
  • hpc markup Main.tix

This is an admittedly small issue, but it can be valuable for a project to aspire to 100% code coverage and false negatives prevent us from getting there.

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Code Coverage
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information