[Haskell-cafe] Using Cabal during development

Antoine Latter aslatter at gmail.com
Sun Feb 14 13:41:33 EST 2010


On Thu, Feb 11, 2010 at 4:28 AM, Limestraël <limestrael at gmail.com> wrote:
>
> 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.
> Nevertheless, I'm not convinced regarding the use of Makefiles with Cabal. I
> happen to think it's a bit outsize.
> A shell script is enough.
> By the way, I've found another way to develop simultaneously a (or many)
> library(ies) and an executable.
> It would be to use a local ghc package database.
>
> In my project directory, I do:
> ghc-pky init pkg.conf.d
>
> It create a directory pkg.conf.d which will contain my local database.
>
> Then all the libs must be configured with:
> cabal configure --package-db pkg.conf.d
> (or 'runhaskell Setup.hs configure --package-db pkg.conf.d' if you don't use
> cabal-install)
> Then build normally ('cabal build')
> Then, the little trouble is that you have to register you newly-built
> manually with a:
> cabal register --inplace
> (Anyone knows how to tell cabal to register automatically to the local pkg
> database?)
>
> 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
>

This is great - now I can do proper benchmarks against my libraries
without doing all-at-once compilation (which seems to change how
inlining works), while at the same time not cluttering up my real
package db.

I have this wrapped up into a shell script, but that assumes I'm not
doing my benchmarks on windows.

Antoine


More information about the Haskell-Cafe mailing list