[Haskell-cafe] cabal, multi-file applications

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Dec 23 12:13:37 EST 2008

On Tue, 2008-12-23 at 17:27 +0100, Cetin Sert wrote:

> when I try to build the following program:
> http://sert.homedns.org/hs/hnm/
> http://sert.homedns.org/hs/hnm/hnm.cabal
> How can I tell in my cabal file that wlan.hs should be built first
> than settings.hs than demo3.hs?

You need to follow the standard file name convention for modules. The
module HNM.WLAN needs to be in the file HNM/WLAN.hs rather than wlan.hs.
Similarly you will need to rename settings.hs to HNM/Settings.hs. That
way cabal and ghc will be able to find the files.

In the .cabal file you do not need these fields:
Extra-Source-Files:  wlan.hs, settings.hs
HS-Source-Dirs:      .

Instead you should use:
other-modules: HNM.WLAN, HNM.Settings

Looking at:
ghc-options:         -fglasgow-exts -O3 --make

you do not need '--make'. Using 'cabal check' or 'sdist' will have other
suggestions for better portability and recommended practise.


More information about the Haskell-Cafe mailing list