cabal beginner issues (other-modules, build-depends)

Two issues I've encountered while trying out cabal: 1. The use of "other-modules" is a bit confusing. I realize now that other-modules must contain all modules in the source tree used by the exposed modules. However, since the package built and installed without error when I left out this field, I was surprised to get undefined references when I tried to use the package. I guess this happened because ghc --make found the other modules automatically, but cabal didn't. I would rather have the build step fail in this case. Maybe cabal shouldn't be using --make. 2. Similar comments apply to build-depends. I wrote a module Foo.hs: module Foo (foo) where import Control.Monad.Identity foo = runIdentity (return ()) and a cabal file (working from an example obviously): Name: foo Version: 1.1 License: BSD3 Build-Depends: base Exposed-modules: Foo This built and installed without error, but when I created another module that imports Foo and tried to compile it with "ghc --make", I got undefined references to Control.Monad.Identity. Eventually, I found that I need to add mtl to build-depends. Again it would have been better to get an error during package creation, and this was particulary tricky to figure out because "build-depends" sounds like it should only affect package at build-time. Another way to look at both issues is that if ghc can figure out other modules and packages itself, the user shouldn't be required to specify them in a cabal file. (I know there are other compilers than ghc.) I am using Debian ghc6 package 6.4-4.1. Andrew

Another way to look at both issues is that if ghc can figure out other modules and packages itself, the user shouldn't be required to specify them in a cabal file. ...
Definitely. Having the list of modules in the .cabal is unnecessary duplication of information (because it's in the sources already). This is bound to get out-of-sync during development - unless you use some kind of Makefile to generate the .cabal file, which defeats the very purpose of Cabal itself. Unrelated question: can someone please share an example that shows how to put user-defined options for haddock in a .cabal? Thanks, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------
participants (2)
-
Andrew Pimlott
-
Johannes Waldmann