[GHC] #12920: Overzealous unused-top-binds

GHC ghc-devs at haskell.org
Wed Jan 23 18:49:07 UTC 2019


#12920: Overzealous unused-top-binds
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2-rc1
      Resolution:                    |             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:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I just ran into this issue in a somewhat different context:

 {{{#!hs
 {-# OPTIONS_GHC -Wunused-top-binds #-}
 module Bug () where

 type A = Int
 type B = A
 type C = B

 a, b, c :: Int
 a = 42
 b = a
 c = b
 }}}
 {{{
 GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug2.hs, interpreted )

 Bug2.hs:6:1: warning: [-Wunused-top-binds]
     Defined but not used: type constructor or class ‘C’
   |
 6 | type C = B
   | ^^^^^^^^^^

 Bug2.hs:9:1: warning: [-Wunused-top-binds]
     Defined but not used: ‘a’
   |
 9 | a = 42
   | ^

 Bug2.hs:10:1: warning: [-Wunused-top-binds]
     Defined but not used: ‘b’
    |
 10 | b = a
    | ^

 Bug2.hs:11:1: warning: [-Wunused-top-binds]
     Defined but not used: ‘c’
    |
 11 | c = b
    | ^
 Ok, one module loaded.
 }}}

 It appears that `-Wunused-top-binds` has different transitivity behavior
 when it comes to functions vs. type synonyms: the former has transitive
 behavior, whereas the latter does not.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12920#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list