[Haskell-cafe] Cabal has trouble with projects that have both src and lib directories?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Aug 17 10:49:08 EDT 2008


On Thu, 2008-08-14 at 22:32 -0400, Nicholas Andrews wrote:
> Hi!
> 
> I'm trying to set up a project with both src and lib directories with
> cabal. My blah.cabal file looks like:
> 
> Library
>     Build-Depends:      base
>     Exposed-Modules:    Foo
>     hs-source-dirs: lib/foo
> 
> Executable hai
>     Build-depends:      base
>     Main-is:            Bar.hs
>     ghc-options:        -O
>     hs-source-dirs:     src/bar
>     Other-Modules:      Foo
>     extra-libraries:    Foo
>     extra-lib-dirs:     lib/bar

You will have to use:

> Library
>     Build-Depends:      base
>     Exposed-Modules:    Foo
>     hs-source-dirs: lib/foo
> 
> Executable hai
>     Build-depends:      base
>     Main-is:            Bar.hs
>     hs-source-dirs:     src/bar, lib/bar
>     Other-Modules:      Foo

Theo only downside is that the module Foo will be built twice.

> What's wrong?

Currently there is no way for the hai executable to use "build-depends:
blah", (though that's the obvious way in future that we could let an exe
depend on a lib in the same package).

See:
http://hackage.haskell.org/trac/hackage/ticket/89
http://hackage.haskell.org/trac/hackage/ticket/276

Duncan



More information about the Haskell-Cafe mailing list