[GHC] #9244: Compiler could warn about type variable shadowing, and hint about ScopedTypeVariables

GHC ghc-devs at haskell.org
Wed Jan 20 02:03:39 UTC 2016


#9244: Compiler could warn about type variable shadowing, and hint about
ScopedTypeVariables
-------------------------------------+-------------------------------------
        Reporter:  stusmith          |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  7.6.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #1316, #3691,     |  Differential Rev(s):
  #11438,10581                       |
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * related:  #1316, #3691, #11438 => #1316, #3691, #11438,10581


Comment:

 @goldfire in #10581:
 > The ScopedTypeVariables extension is one of the few that doesn't
 recommend itself when it should be used.
 >
 > I recognize that this may be hard to do, but here is a strawman
 proposal: Always behave as if ScopedTypeVariables is on at binding sites
 for type variables (in an annotation with forall). Then, at occurrences of
 type variables, check if the extension is on. If a type variable is in
 scope but the extension is off, remember that the user probably wants the
 extension, but then rename the type variable occurrence away from the in-
 scope one. If a type error ensues, we've remembered that the lack of
 ScopedTypeVariables may be to blame, and we recommend turning it on.

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


More information about the ghc-tickets mailing list