[Haskell-cafe] Packages and modules

Robert Dockins robdockins at fastmail.fm
Sun Jun 25 18:32:44 EDT 2006


On Sunday 25 June 2006 05:16 am, Brian Hulley wrote:
> Hi -
> At the moment there is a problem in that two packages P and Q could contain
> the same hierarchical module eg Data.Foo, and the only way for user code to
> ensure the "right" Data.Foo is used is to ensure that packages P and Q are
> searched in the right order.
> However suppose P and Q also contain another module with the same name, eg
> Data.Bar.
> And suppose a user module wants to use Data.Foo from P but Data.Bar from
> Q!!!
>
> I'm wondering: would it not be easier to just make it that the package name
> is prepended to the hierarchical module name, so the modules would instead
> be called by the names P.Data.Foo and Q.Data.Bar?

[snip discussion of this idea]

The idea of improving the module system has been discussed a number of times 
before.  Here is a thread started by a suggestion from the simons which 
generated a fair bit of discussion:

http://www.haskell.org/pipermail/libraries/2003-August/001310.html

I'm not sure whatever became of this idea; discussion seemed to sort of reach 
a consensus, and then nothing happened.

The module "grafting" mechanism always seemed kind of nice to me.  I think 
some of the problems discussed in this thread could be by using cabal, 
especially to specify the graftings expected for compilation.  It seems like 
grafting can give a plausible story for dealing with dynamicly loaded code, 
which is a nice bonus.


-- 
Rob Dockins

Talk softly and drive a Sherman tank.
Laugh hard, it's a long way to the bank.
       -- TMBG


More information about the Haskell-Cafe mailing list