[GHC] #10625: Spurious unused quantified type variable warning with ExistentialQuantification

GHC ghc-devs at haskell.org
Thu Jul 9 14:28:03 UTC 2015


#10625: Spurious unused quantified type variable warning with
ExistentialQuantification
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  RyanGlScott                        |            Status:  new
                  Type:  bug         |         Milestone:
              Priority:  normal      |           Version:  7.10.1
             Component:  Compiler    |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  Incorrect
          Architecture:              |  warning at compile-time
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:  #5331
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 When using an existentially quantified type variable that shadows another
 variable in a data declaration, {{{-Wall}}} produces more warnings than
 necessary:

 {{{
 $ ghci -XExistentialQuantification -Wall
 GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
 λ> data Ex a = forall a. Ex a

 <interactive>:2:20: Warning:
     Unused quantified type variable ‘a’
     In the definition of data constructor ‘Ex’

 <interactive>:2:20: Warning:
     This binding for ‘a’ shadows the existing binding
       bound at <interactive>:2:9
 }}}

 The unused quantified type variable warning seems wrong, since it ''is''
 being used (as the shadowing warning indicates). Curiously, this warning
 doesn't seem to appear when doing something similar with {{{RankNTypes}}}:

 {{{
 $ ghci -XRankNTypes -Wall
 GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
 λ> data Ex a = Ex (forall a. a)

 <interactive>:2:24: Warning:
     This binding for ‘a’ shadows the existing binding
       bound at <interactive>:2:9
 }}}

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


More information about the ghc-tickets mailing list