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

Henning Thielemann lemming at henning-thielemann.de
Wed Jul 9 01:06:05 EDT 2008


On Wed, 9 Jul 2008, Neil Mitchell wrote:

> It seems that the qualified import syntax is a bit awkward. At the
> moment, its common to see:
>
> import qualified Data.Map as M
> import Data.Map(Map)
>
> i.e. import a module, give it an alias (M), and put some things in the
> current namespace (Map).
>
> Another way some people sometimes do it is:
>
> import qualified Data.Map as M
> import Data.Map hiding (lookup)
>
> i.e. import a module, give it an alias (M), and exclude some things
> from the current namespace.
>
> Both of these require two imports, yet feel like they should require
> only one. It seems as though the import syntax more naturally promotes
> security (preventing access to some functions), rather than
> namespacing.
>
> 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'?


More information about the Haskell-Cafe mailing list