[GHC] #837: Infer fully qualified names to overcome namespace clashes

GHC trac at galois.com
Thu Jul 27 23:23:43 EDT 2006


#837: Infer fully qualified names to overcome namespace clashes
-----------------------------------+----------------------------------------
    Reporter:  p.tanski at gmail.com  |        Owner:  nobody 
        Type:  feature request     |       Status:  new    
    Priority:  normal              |    Milestone:         
   Component:  Compiler            |      Version:  6.4.2  
    Severity:  normal              |     Keywords:         
          Os:  Unknown             |   Difficulty:  Unknown
Architecture:  Unknown             |  
-----------------------------------+----------------------------------------
If you could interpret Section 5.5.2 of the last published Haskell Report
 (1998) as meaning: "[i]t is not an error for there to exist names [such as
 A.f or f] that cannot be ... resolved [by the implementation] ..."  Then
 it would be exceptionally handy for GHC to be able to infer what any human
 being can infer from most name usage in a function.  For example:

 import Data.Map
 import Data.List

 runThroughMap :: (Ord k) => Map k a -> Map k b
 runThroughMap m = map  f  m

 runThroughList :: [a] -> [b]
 runThroughList l = map  g  l

 GHC will produce an error that this "map" is an ambiguous reference and
 provides a nice error message containing the fully qualified names.  If
 you accept a permissive interpretation of Section 5.5.2 of the '98 Report,
 GHC could infer from context that map in `runThroughMap` is being used on
 a Map and therefore should be fully qualifiable and unambiguous; similarly
 for map used in `runThroughList.`

 Of course, if you disagree with this interpretation for whatever reason--
 many reasons are practical--feel free to delete this feature request...

 W.B.R.
  -Peter T.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/837>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list