Cabal has trouble with projects that have both src and lib directories?

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 But I get: $ runhaskell blah.cabal configure $ runhaskell blah.cabal build src/bar/Bar.hs:6:7: Could not find module `Foo': Use -v to see a list of the files... In Bar.hs, line 6 says "import Svm" What's wrong? Thanks!

"Nicholas Andrews"
$ runhaskell blah.cabal configure
blah.cabal isn't a Haskell file, you need a file Setup.hs that you can 'runhaskell'. Setup.hs need only contain the following three lines: #!/usr/bin/env runhaskell import Distribution.Simple main = defaultMain -k -- If I haven't seen further, it is by standing in the footprints of giants

Sorry, I meant runhaskell Setup.hs
"Nicholas Andrews"
writes: $ runhaskell blah.cabal configure
blah.cabal isn't a Haskell file, you need a file Setup.hs that you can 'runhaskell'. Setup.hs need only contain the following three lines:
#!/usr/bin/env runhaskell import Distribution.Simple main = defaultMain
-k -- If I haven't seen further, it is by standing in the footprints of giants

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
participants (3)
-
Duncan Coutts
-
Ketil Malde
-
Nicholas Andrews