Infer fully qualified names to overcome namespace clashes
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.4.2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |