[Haskell-cafe] Design your modules for qualified import

Ketil Malde ketil at malde.org
Mon Jun 9 10:04:48 EDT 2008


ajb at spamcop.net writes:

>>   null
>>   filter
>>   map
>>   lookup

> On the contrary, these are terrible names _because_ they conflict
> with the Prelude.

I agree.  One solution would be to stuff these into Data.List.

> It's okay if you highly encourage or effectively mandate qualified
> import, like Data.Map does.

I think designing modules for qualified-only use is a mistake.  I also
think import lists get quite ugly, with multiple instances of

      import qualified Data.Set as S
      import Data.Set (Set)

for multiple - sometimes even the majority - of modules.

Add to this that people will assign a variation of abbreviations for
modules, we quickly lose consistency.

And - is there a way to make GHCi use aliased qualification?  I find
my self typing detailed taxonomies all the time there.

For Haskell', I would relly like to have good, generic
classes/interfaces for this, so that a) code becomes readable
(including import lists), and b) code can be written more generically,
and c) it becomes easier to switch between e.g. different string
types. 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list