[Haskell-cafe] Re: Open unqualified imports

Henning Thielemann lemming at henning-thielemann.de
Wed Feb 4 19:22:29 EST 2009


On Wed, 4 Feb 2009, Simon Marlow wrote:

> Ian Lynagh wrote:
>> On Fri, Jan 16, 2009 at 06:42:46AM -0800, eyal.lotem at gmail.com wrote:
>>> Closed-unqualified import:
>>> import Data.Map(Map, lookup)
>> 
>> One problem with this style is that you can get lots of conflicts from
>> your VCS if you have multiple people working on the same module.
>
> Right; in GHC we actively discourage the use of explict import lists (or 
> closed-unqualified import to use the terminology of this thread).
>
> http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Imports
>
> I find that the reasons not to use explicit import lists outweigh the reasons 
> to use them, at least for code that I'm working on (rather than just 
> reading).
>
> Ideally the import lists would be maintained automatically by an IDE, and 
> would be intelligently handled by the VCS.

This will work only if you exclusively import from modules of the same 
project, where you can choose identifiers to never clash, and external 
library modules where no functions are added anymore. Certainly for GHC 
this works since the compiler as basis tool must not depend on many 
libraries. However for me the situation is that I use many libraries, each 
maintained by only a few people. Within this kind of development name 
clashes are more likely than versioning conflicts. The only style that 
avoids both kinds of conflicts is the qualified import, which I try to use 
whereever possible.


More information about the Haskell-Cafe mailing list