[Haskell-cafe] Qualified import syntax badly designed (?)

Thomas Davie tom.davie at gmail.com
Wed Jul 9 03:04:23 EDT 2008

>> I think a better design for namespacing might be:
>> import Data.Map as M implicit (Map)
>> import Data.Map as M explicit (lookup)
> Why 'implicit' and 'explicit'? Do you mean something like 'include'  
> and 'exclude'?

To me at least, implicit and explicit make more sense.  I don't want  
to exclude importing lookup, I want to make it so I have to explicitly  
tag lookup as being M.lookup.  Similarly, I don't want to include Map  
(as opposed to all the other things I'm getting from Data.Map), I just  
want to make it so that when I say Map, I implicitly mean M.Map.

Personally I'd extend this syntax (something Neil may have had in  
mind), so that

import Data.Map as M (lookup, union) implicit (Map)
gives me M.lookup, M.union and Map

import Data.Map as M hiding (union) explicit (lookup)
gives me everything in Data.Map with no qualification except for union  
and lookup, plus it gives me M.lookup.


More information about the Haskell-Cafe mailing list