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

Andrew Pimlott andrew at
Thu Sep 22 18:02:29 EDT 2005

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

    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.


More information about the Libraries mailing list