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

GHC ghc-devs at haskell.org
Mon Jun 30 09:38:50 UTC 2014


#9244: Compiler could warn about type variable shadowing, and hint about
ScopedTypeVariables
-------------------------------------------------+-------------------------
        Reporter:  stusmith                      |            Owner:
            Type:  feature request               |           Status:  new
        Priority:  normal                        |        Milestone:
       Component:  Compiler                      |          Version:  7.6.3
      Resolution:                                |         Keywords:
Operating System:  Unknown/Multiple              |     Architecture:
 Type of failure:  Incorrect warning at          |  Unknown/Multiple
  compile-time                                   |       Difficulty:
       Test Case:                                |  Unknown
        Blocking:                                |       Blocked By:
                                                 |  Related Tickets:
-------------------------------------------------+-------------------------

Comment (by simonpj):

 I think that's a fine idea. The easiest place to try this might be the
 renamer.  At the moment the type signature for `tryMaybe`
 {{{
 tryMaybe :: IO a -> IO (Maybe a)
 }}}
 does not bring `a` into scope in the body.  You need
 `-XScopedTypeVariables`, ''and'' you need an explicit forall:
 {{{
 tryMaybe :: forall a. IO a -> IO (Maybe a)
 }}}
 But it might be reasonable for the renamer to suggest that this is perhaps
 what you intended, when it comes across that `a` mentioned in
 {{{
 (try action) :: IO (Either SomeException a)
 }}}
 Simon

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


More information about the ghc-tickets mailing list