[Haskell-cafe] Re: Using Cabal during development

Maurí­cio CA mauricio.antunes at gmail.com
Thu Feb 11 06:19:41 EST 2010


 > Eventually, I think using cabal during development may be
 > convenient. The only drawback is that you have to specify each
 > dependency and -- above all -- every module each time you add
 > one.

When writing bindings-posix, bindings-glib etc., which have lots
of modules, I used a shell script to take all modules under ./src
to .cabal. What it did was: 1) for each subdirectory, create a .hs
file that reimport all modules under that subdirectory; 2) list
all .hs (and, in my case, also .hsc) under ./src and insert then
into .cabal.

I've found that scripts of this kind have been very usefull. They
require you to follow some rules (like, say, all modules with name
mapping to directories are always a reimport of submodules).

 > Then, to compile you executable with ghc (because Cabal is
 > definitely not convient when you have a lib and an executable in
 > the same package): ghc --make --package-conf pkg.conf.d main.hs
 >
 > Again, should you have better/simpler ways to achieve this, I
 > would be glad to know them.

I usually find useful, at first, to build only the executable and
leave the library. When modules get stable enough, I separate
both. Other scripts have been also usefull: one to check
uncommited changes in all packages I'm working in, other to sync
all my local packages with their repos. You could have a single
'b' script you could run like:

b l # build and install your library in local database
b t # build and run your test package executable
b m # update module list in .cabal file for all your packages
etc.

Best,

Maurício



More information about the Haskell-Cafe mailing list