[Haskell-cafe] Re: Open unqualified imports
alexander.dunlap at gmail.com
Wed Feb 4 21:00:08 EST 2009
On Wed, Feb 4, 2009 at 4:22 PM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
> 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).
>> 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
>> 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.
Another solution would be an automated tool to add explicit import
lists as part of the release process. Then you don't have to worry
about maintaining them but once you do the final release, you know
that it won't break if new functions are added to dependencies.
Perhaps I will create such a tool sometime...
More information about the Haskell-Cafe