[Haskell-cafe] Re: Design your modules for qualified import
Jan-Willem Maessen
jmaessen at alum.mit.edu
Fri Jun 6 16:35:16 EDT 2008
On Jun 6, 2008, at 12:54 PM, Henning Thielemann wrote:
>
> On Fri, 6 Jun 2008, Achim Schneider wrote:
>
>> Jan-Willem Maessen <jmaessen at alum.mit.edu> wrote:
>>
>>> 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
Precisely. If I import the prelude qualified and your library
unqualified, is my code readable? I should hope it is. And if the
library used the overlapping names reasonably, you shouldn't be left
wondering when you read my code.
>>> The following are terrible names:
>>> T
>>> C
>>
>> Not to mention that this usage is hideously confusing while looking
>> at
>> the haddock docs.
>
> But that will be resolved when Haddock can show identifiers with
> qualifications.
I specifically *didn't* bring up the Haddock issue, because I think
it's a side show. Fundamentally, these types are neither clear nor
descriptive. Their treatment by one or another documentation tool is,
at some level, beside the point.
> It's good to have fine grained modules, because you can more easily
> exchange the parts you want different from the standard way. For
> reducing
> import lists for simple songs I think we could provide wrapper
> modules.
Make your modules as small as you like; small modules are great. But
keep things readable, please!
-Jan
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list