Libraries and hierarchies

Simon Marlow
Wed, 6 Aug 2003 09:19:51 +0100

Ketil Z. Malde writes:
> I presume that paths specified by -i (isn't it?) also will be grafted
> into the root of the tree.
> How do you deal with a file "Foo.lhs" declaring "module Bar.Zot.Foo",
> say, in the current directory?  Is it legal to import it as "import
> Foo"?  Or "import Bar.Zot.Foo"?  Both?

A file Foo.lhs in the current directory should declare module Foo,
anything else is an error.  Within the current package (ie. the current
set of modules that you're compiling, whether that's a program or a
library), it can only be imported as module Foo.

In another package, it could be imported as Bar.Zot.Foo, if the package
containing Foo has been sited at Bar.Zot.

> Is it really necessary and desirable to specify the whole path as part
> of the module declaration?=20

Under the proposed scheme, the module name in the module declaration
would be relative to the root of the current package.

Hope this helps!