[Haskell-cafe] cabal, multi-file applications

Gwern Branwen gwern0 at gmail.com
Tue Dec 23 11:59:56 EST 2008

Hash: SHA512

2008/12/23 Cetin Sert :
> Hi,
> I get the following error message:
> cetin at unique:~/lab/test/qths/hnm$ make configure
> runhaskell Setup.hs configure
> Configuring HNM-0.2...
> cetin at unique:~/lab/test/qths/hnm$ make build
> runhaskell Setup.hs build
> Preprocessing library HNM-0.2...
> Preprocessing executables for HNM-0.2...
> Building HNM-0.2...
> demo3.hs:4:7:
>     Could not find module `HNM.WLAN':
>       Use -v to see a list of the files searched for.
> make: *** [build] Error 1
> 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?
> Best Regards,
> Cetin Sert

You need some changes like this (as a Darcs patch):

adddir ./HNM
move ./settings.hs ./HNM/Settings.hs
move ./wlan.hs ./HNM/WLAN.hs
hunk ./hnm.cabal 3
- -Description:         Happy Network Manager
- -License:             BSD
+Synopsis:            Happy Network Manager
+Category:            Network, System
+homepage:            http://sert.homedns.org/hs/hnm/
+License:             BSD3
hunk ./hnm.cabal 9
- -Maintainer:          cetin at sertcom.de
hunk ./hnm.cabal 13
+data-files:         settings.conf
hunk ./hnm.cabal 17
- -ghc-options:         -O3 -fglasgow-exts
+other-modules:       HNM.WLAN, HNM.Settings
+ghc-options:         -O2 -fglasgow-exts

Note that -O3 is counterintuitively no better than -O2, and may be
worse. You should probably change the -fglasgow-exts to individual
per-file {-# LANGUAGE #-} pragmas. And you don't declare all your
dependencies, for example I see Gtk2Hs imports, but no declarations in

To solve your problem, you need to put the module names in
other-modules:, but your modules are at wrong names. If a module's
name is HNM.Settings, then it needs to be at Settings.hs.

- --
Version: GnuPG v1.4.9 (GNU/Linux)


More information about the Haskell-Cafe mailing list