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

GHC ghc-devs at haskell.org
Wed Jan 20 01:56:10 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                             |
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * related:   => #1316, #3691, #11438
 * milestone:   => 8.2.1


Comment:

 Also reported as #1316, #3691, #11438 and maybe others.

 @goldfire writes in ticket:11438#comment:1 (I'm moving the discussion
 here):

 > An easy way of suggesting ScopedTypeVariables just came to mind: pretend
 the extension is always on. When looking up a type variable, if the
 extension is off but the variable would be in scope otherwise, suggest the
 extension, while returning a lookup failure (because the variable really
 isn't in scope!). Getting caught on ScopedTypeVariables is a fairly common
 occurrence in my experience, so I think it's worth putting in a bit of
 effort to do better here. (Even better would be to look for type variables
 in a signature that's missing a forall to suggest adding the forall, but
 that can be a separate task.)

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


More information about the ghc-tickets mailing list