Questions concerning hierarchical module system

Malcolm Wallace [email protected]
Thu, 18 Apr 2002 10:25:39 +0100


Wolfgang Jeltsch <[email protected]> writes:

> I have some questions regarding the hierarchical module system now 
> implemented in Hugs as well as in GHC.

... and nhc98...

> Currently it is possible to have a module A1.A2. ... .Am and a module
> A1.A2. ... .Am. ... .An (n > m) at the same time. The first one's source
> code would be in file <root>/A1/A2/ ... /Am.hs and the second one's in
> file <root>/A1/A2/ ... /Am/ ... /An.hs. So there would be both a Am.hs
> file and a Am directory in the same directory. A1.A2. ... .Am would have
> two meanings: a module and a "module container". Hugs and GHC doesn't
> seem to have problems with this. But I want to know if I can rely on
> this behaviour still beeing present in future implementations and if
> this kind of module organisation is maybe considered bad practice.

I think you can rely on this feature, and in fact I would call it good
practice.  The main benefit is that A.B.C can export a more abstract
user-level interface, whilst the deeper-nested modules A.B.C.[D|E|F]
export the concrete internal implementation, in case an advanced user
needs to somehow modify the standard abstraction.

Regards,
    Malcolm