[GHC] #9990: Top level module identifiers shadow imported identifiers

GHC ghc-devs at haskell.org
Tue Jan 20 20:58:44 UTC 2015


#9990: Top level module identifiers shadow imported identifiers
-------------------------------------+-------------------------------------
        Reporter:  drb226            |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by drb226):

 Another idea is to make a per-binding pragma.


 {{{#!hs
 import Data.Monoid

 {-# SHADOWS (<>) #-}
 (<>) = mappend
 main = putStrLn ("Hello" <> " " <> "World")
 }}}

 This technique avoids unintended shadowing, intentionally resolves
 ambiguity by shadowing imports, and shouldn't need to set off the regular
 shadow warnings.

 This same technique could also be used to annotate imports:

 {{{#!hs
 import Foo

 {-# SHADOWS foo, Bar(..) #-}
 import OtherFoo
 }}}

 Just throwing that idea out there. Unlike `hiding`, the SHADOWS pragma
 could check to make sure that the replacement actually exists.

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


More information about the ghc-tickets mailing list