[Haskell-cafe] Re: Design your modules for qualified import

Achim Schneider barsoap at web.de
Fri Jun 6 10:57:07 EDT 2008

Jan-Willem Maessen <jmaessen at alum.mit.edu> wrote:

> On Jun 6, 2008, at 8:12 AM, Wolfgang Jeltsch wrote:
> > 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.
> There's one caveat: Always choose descriptive names, even if you are  
> assuming that you will usually use a qualified import.  The
> following are wonderful names, even though they conflict with the
> prelude: null
>    filter
>    map
>    lookup
import Prelude as P

> The following are terrible names:
>    T
>    C
Not to mention that this usage is hideously confusing while looking at
the haddock docs. While I don't mind Haskore having them, they should
just be different names for a type that has a clear name. It also
appears to generate an excessive amount of modules.

(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 

More information about the Haskell-Cafe mailing list