Duncan Coutts duncan.coutts at
Thu May 19 07:36:25 EDT 2005

On Wed, 2005-05-18 at 13:41 -0400, S. Alexander Jacobson wrote:
> On Wed, 18 May 2005, Isaac Jones wrote:
> > "S. Alexander Jacobson" <alex at> writes:
> >
> >> With Cabal, if you download two packages, how do you know that they
> >> won't require conflicting versions of another module/package?
> >
> > That's specified by the dreaded build-depends field, of course.
> So you like to use packages P1 and P2.  You've decided to build a 
> program that uses both of them.  How does build-depends tell you that 
> they both don't use the same hidden module name?
> Or suppose that P1 build-depends on P3 and P2 depends on P4 and both 
> P3 and P4 expose the same module name.
> With build-depends, you don't discover these sorts of conflicts 
> until you happen to use packages together.
> Module maps give you a promise that a set of packages are compatible 
> with one another (don't overlap).

Actually, I think that this can be done with the cabal "build-depends".
Each .cabal file says which modules the package exposes and which are
hidden (although for our purposes of ensuring no overlaps the
visible/hidden distinction is irrelevant).

So all we do is trace the modules provided by the package in question
and all modules provided by all packages it "build-depends" upon, and so
on recursively.

This gives us the complete set of modules used by a package and so we
can see if two packages are compatible by checking if their module sets
overlap, and if they do overlap we can see if any of the overlapping
modules have different .hi files (or just the .hi file paths would
probably be sufficient).

This does ignore the current problem of modules that are provided by
exposed packages are effectively part of your program's module set
wether or not use use them or any modules from packages which use them
(see the 'hslibs' problem).


More information about the Libraries mailing list