Spurious unused quantified type variable warning with ExistentialQuantification
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
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |