[Haskell-cafe] What's in a name?
dave at zednenem.com
Fri Aug 15 17:53:48 EDT 2008
Whoops. Forgot to hit "reply all".
On Wed, Aug 13, 2008 at 4:58 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> The naming of cats is a difficult matter...
> Ahem. So as you may have noticed, we seem to have a profusion of packages
> all called "binary" or something dangeriously similar. There's also several
> "MD5" packages. I could point out a few others. So what I'm wondering is...
> Do we have a formal convention for the naming of packages and/or the naming
> of the modules they contain? How are name collisions supposed to be avoided?
> (E.g., Java uses domain names for this. If I write a package named Foo, I
> put all the classes in orphi.me.uk.Foo.*)
So far as I know, there are no rules about naming packages, except
that Hackage won't allow two packages with the same name.
There is a loose convention about fitting modules into the larger
hierarchy. Personally, I think trying to fit modules from different
packages into the same hierarchy is a mistake, in that you either get
the same module name used twice (meaning that both packages can't be
used in the same program), or need to insert the package name into the
Thus, "Test.HUnit", "Test.QuickCheck",
"Text.ParserCombinators.Parsec", "Text.Pretty.HughesPJ", and so forth.
We'd be better off just using the package name as the first element of
the module names. Or, if that's objectionable, using something like
"Package.Parsec" or "Lib.Parsec" (or "Hackage.Parsec", since Hackage
enforces the uniqueness of package names).
This is arguably one area where Java does better than Haskell. The
resulting module names are long, but they don't require coordination
and they don't raise tricky questions. (Quick, what's the difference
between Data.* and Control.*? Is QuickCheck under Debug.* or Test.*?)
Dave Menendez <dave at zednenem.com>
More information about the Haskell-Cafe