Opened 11 months ago

Last modified 11 months ago

#15932 new bug

DeriveFunctor and GeneralizedNewtypeDeriving instances never reporting as covered

Reported by: davean Owned by:
Priority: low Milestone:
Component: Code Coverage Version: 8.6.2
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When testing coverage of test cases, HPC does not report some instances as receiving coverage even though it seems they are. Particularly, when one hand derives the functions they show full coverage. The specific instances in question appear to be ones derived via DeriveFunctor and GeneralizedNewtypeDeriving. Problems have been observed with at least Functor, Applicative, and Monad.

A minimal example is attached, and available as a cabal project at To reproduce, run "cabal v2-test --enable-coverage" and view the resulting coverage HTML files.

Attachments (2)

Cov.hs (287 bytes) - added by davean 11 months ago.
test.hs (320 bytes) - added by davean 11 months ago.

Download all attachments as: .zip

Change History (4)

Changed 11 months ago by davean

Attachment: Cov.hs added

Changed 11 months ago by davean

Attachment: test.hs added

comment:1 Changed 11 months ago by bgamari

Keywords: newcomer added

I suspect this wouldn't be too hard to fix. The relevant implementation bits can be found in deSugar/Coverage.hs; I would start by looking at the -ddump-ds output to verify that there are no coverage ticks in the derived instances. If this really is the issue then I suspect a solution should be straightforward.

comment:2 Changed 11 months ago by bgamari

Milestone: 8.6.3

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.