[Haskell-cafe] Design your modules for qualified import

ajb at spamcop.net ajb at spamcop.net
Sat Jun 7 02:45:43 EDT 2008

G'day all.

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

> 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

On the contrary, these are terrible names _because_ they conflict
with the Prelude.  Especially "map", for which there's no excuse.
If it does the obvious thing, it's far better to define a real
Functor instance.

It's okay if you highly encourage or effectively mandate qualified
import, like Data.Map does.  However, unlike Data.Map, if you do
that then please don't define any operators.  Requiring someone to
type m M.! k is just wrong.

Andrew Bromage

More information about the Haskell-Cafe mailing list