Ticket #1954 (closed merge: fixed)
Incorrect "Defined but not used" warning when using GeneralizedNewtypeDeriving
| Reported by: | magnus | Owned by: | igloo |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.12 branch |
| Component: | Compiler | Version: | 6.8.1 |
| Keywords: | Cc: | ndmitchell@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | rename/should_compile/T1954 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
When compiling
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -Wall -Werror #-}
module Bug(P, runP) where
import Control.Monad.Identity(Identity, runIdentity)
newtype P a = P { unP :: Identity a } deriving Monad
runP :: P a -> a
runP = runIdentity . unP
I get
Bug.hs:7:14: Warning: Defined but not used: data constructor `P'
although the constructor is used in the derived Monad instance. This is obviously not a show stopper, but it forces me to rewrite what to me looks like an OK program if I want to stick to the given OPTIONS_GHC.
Change History
Note: See
TracTickets for help on using
tickets.
