[Haskell-cafe] a cabal package with both a library and executable programs

Manlio Perillo manlio_perillo at libero.it
Wed Mar 25 10:10:49 EDT 2009


Hi.

This example is taken from the Cabal documentation:

Name:            TestPackage
...

Library
   Build-Depends:   HUnit
   Exposed-Modules: A, B, C

Executable program1
   Main-Is:         Main.hs
   Hs-Source-Dirs:  prog1
   Other-Modules:   A, B

Executable program2
   Main-Is:         Main.hs
   Hs-Source-Dirs:  prog2
   Other-Modules:   A, C, Utils


Here I see a small problem.
Why should I explicitly declare modules from the library that are used 
in the executables?

I would like to do, instead

...

Executable program1
   Main-Is:         Main.hs
   Hs-Source-Dirs:  prog1
   build-depends:   TestPackage

Executable program2
   Main-Is:         Main.hs
   Hs-Source-Dirs:  prog2
   build-depends:   TestPackag
   Other-Modules:   Utils


I tried this, but configuration fails, since Cabal does not find the 
TestPackage.
It is true that it does not yet exists, but we are going to build it!


Should I fill a feature request ticket, or this is how it is supposed to 
work?



Thanks  Manlio


More information about the Haskell-Cafe mailing list