[GHC] #15618: Unused binding warning should not apply to newtype constructors
GHC
ghc-devs at haskell.org
Sat Sep 8 04:18:26 UTC 2018
#15618: Unused binding warning should not apply to newtype constructors
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.6.1-beta1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Incorrect
Unknown/Multiple | error/warning at compile-time
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{#!hs
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!
1. It's ''impossible'' to define a newtype without giving it a data
constructor.
2. 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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15618>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list