multiple cabal files in one directory?

Magnus Therning magnus at therning.org
Wed Jan 12 13:18:51 CET 2011


On Wed, Jan 12, 2011 at 11:59, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
>
> On Wed, 12 Jan 2011, Peter Simons wrote:
>
>> > So you could in principle call it description.cabal consistently in
>> > all your packages.
>>
>> Is it also possible to use a package-specific name for Setup.hs? If I'd
>> be writing a package called "foo", could I use the name "foo.cabal" and
>> "foo.setup" to designate my build instructions? I'd also be happy to
>> call the "Setup.hs" file "Setup-foo.hs" or "Foo-setup.hs" or whatever,
>> as long as there's a package-specific component in the name that matches
>> the one I used for the Cabal file.
>>
>> If that were the case, then multiple packages could be stored in one
>> directory, and a build call like
>>
>>  cabal configure --package=foo
>>
>> would be unambiguous.
>
> I think this leads to nothing - you would also need directories like
> dist-foo and maybe more in the future. The one-directory-to-one-package
> relation makes things easy and that's somehow what directories are for. The
> other way round makes more sense to me: Give all package Cabal files the
> same name (main.cabal?), since the package name is already given by the
> directory name. Maybe in the future someone wants a Cabal include mechanism
> that allows to write one Cabal file per executable and to put them together
> according to include statements in main.cabal.
>
> The discussion and the personal preferences are certainly similar to whether
> to put many modules into one file, or whether to define identifiers for
> unqualified import and export many modules by one main module.
>
> My question is: What is really the benefit of having multiple packages in
> one directory? kahl at cas.mcmaster.ca has commented on this question, but his
> use case didn't convince me. Building many packages at once, an
> inter-package Make so to speak, would be nice, but this could be separate
> from the technique of building one package.

Couldn't that use case also be solved by allowing multiple Library
sections in the Cabal file (similar to how multiple Executable
sections are allowed).  This may, or may not, be easier to deal with
than having multiple Cabal files.

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus



More information about the Libraries mailing list