multiple cabal files in one directory?

Henning Thielemann lemming at
Sat Jan 8 12:02:04 CET 2011

> On Fri, Jan 7, 2011 at 9:41 PM,  <kahl at> wrote:
>> My use case would be the following: I have a large library,
>> which I want to split into several cabal packages.
>> However, I would like to keep the whole library in a single
>> hierarchical module directory structure,
>> so when I decide to move some module from one package to another,
>> I only have to move a line from one .cabal file to another,
>> and not move any files.

I would make multiple directories, each with a Cabal file and then make a 
symbolic link to the source directory from each of these Cabal 

However moving a module from one package to another one is a relatively 
large step, that breaks other packages and thus requires increasing the 
major version. I find it appropriate to move files for such a change.

I also tried to manage several Cabal packages in one Darcs repository, 
e.g. the set of data-accessor packages. But I do not like that anymore 
since each sub-package has its own version and this does not work well 
with Darcs tags and the Darcs patch comments.

On Fri, 7 Jan 2011, Antoine Latter wrote:

> Even if that worked in Cabal, you would run into other problems -
> taking a module out of a package description file doesn't stop GHC
> from using it during compilation if it can find it, but it does stop
> GHC from linking it. So you'd end up with lots of fun linker errors.

That's unfortunately true. However I have written a small script, that 
'sdist's a package, unpack it in /tmp/ and try to build it with Cabal 
there. I run this script before uploading to Hackage in order to check for 
missing files. Since I use Darcs it can easily happen that Darcs 
registration and Cabal registration of files are out of sync. If a file is 
added to Darcs repository but not to Cabal description, then the Darcs 
test, that builds the package will succeed because of GHC's --make 
feature. Maybe I should put my script into a Cabal package? Or try to 
integrate it into cabal-install?

More information about the Libraries mailing list