[Haskell-cafe] Design your modules for qualified import

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Fri Jun 6 08:12:23 EDT 2008


Am Donnerstag, 5. Juni 2008 17:19 schrieb Johan Tibell:
> […]

> 2. It's the default. You have to add "qualified" to all your imports
> to make them qualified. In most language imports are qualified by
> default. I think the latter would have been a better choice but we
> have to live with the current design so bite the bullet and add those
> qualified keywords to your imports.

If you leave out “qualified”, you still get the qualified names imported.  And 
if you use conflicting identifiers always qualified then there’s no problem.  
For example, you can use

    import Data.Set as Set
    import Data.List as List

and then just say Set.null or List.null.

> […]

> * Summary
>
> Whenever you write a library design it so it works well with qualified
> imports. That means leaving namespacing issues to the module system.
> Try to think of how code using your functions will look like if it
> uses them qualified.

I totally agree.

> […]

Best wishes,
Wolfgang


More information about the Haskell-Cafe mailing list