Unused binding warning should not apply to newtype constructors
module Foo (A, foo) where
import Data.Type.Coercion
newtype A = A Int
foo :: Coercion A Int
foo = Coercion
produces a warning:
NTCon.hs:4:13: warning: [-Wunused-top-binds]
Defined but not used: data constructor ‘A’
|
4 | newtype A = A Int
| ^^^^^
This is rather silly!
- It's impossible to define a newtype without giving it a data constructor.
- It's possible to use a newtype without using its data constructor.
Therefore, I believe the only reasonable thing to do is suppress the unused binding warning for newtype data constructors. If the newtype itself isn't used, that will be caught anyway.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.1-beta1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |