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

Ross Paterson ross at
Fri Sep 23 05:19:31 EDT 2005

On Fri, Sep 23, 2005 at 09:50:18AM +0100, Simon Marlow wrote:
> On 23 September 2005 08:45, Johannes Waldmann wrote:
> >> 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.

Module dependency calculation would have to be done in the build
environment, not at the source, because the set of modules used may
be system-dependent.  And you'd still need to specify exposed-modules.

> I know how to do this using GHC, but I'm not sure about other compilers.
> With GHC, we can generate the dependencies using 'ghc -M' and then parse
> the generated Makefile (a bit of a long way around, but I can't think of
> an easier way).  Of course we'd avoid splatting an existing Makefile by
> redirecting the dependencies to a temporary file.
> How would we do this with nhc98 or Hugs?  Perhaps because these systems
> don't actually need to know the value of other-modules we can get away
> with it.  Comments?

Cabal/Hugs needs other-modules to produce a complete package
(if modules are omitted the build succeeds but using it fails).

Cabal/nhc98 doesn't need anything, because it doesn't exist.

More information about the Libraries mailing list