Opened 13 months ago

Last modified 13 months ago

#15498 new bug

HPC: do notation marks () as non-covered

Reported by: tom-bop Owned by:
Priority: normal Milestone: 8.6.1
Component: Code Coverage Version: 8.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect error/warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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
   putStrLn "Unimportant #2"


  • 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.

Change History (1)

comment:1 Changed 13 months ago by osa1

Do you mean () should've marked as evaluated because it's a CAF? Otherwise I think the coverage output is correct, () is never evaluated. Replace () with undefined and you'll see that program output does not change.

Note: See TracTickets for help on using tickets.