[Haskell-cafe] Using Cabal during development

Limestraël limestrael at gmail.com
Thu Feb 11 05:28: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.
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

Again, should you have better/simpler ways to achieve this, I would be glad
to know them.


Simon Michael wrote:
> 
> Another great thread. I'm another who uses both make and cabal. I try to
> automate a lot of things and find a makefile 
> easier for quick scripting. Perhaps at some point I'll get by with just
> cabal. Here's an example:
> 
> http://joyful.com/repos/hledger/Makefile
> 
> An unusual feature, I think, is the use of the little-known sp tool for
> auto-recompiling (see "ci" rule). Typically I 
> leave make ci running in an emacs shell window, where I can watch the
> errors as I edit and save source. I don't have 
> clickable errors currently, I get by with linum-mode. When I need to
> explore I'll run ghci in another shell window. 
> After reading this thread, I'm going to try using C-c C-l more.
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

-- 
View this message in context: http://old.nabble.com/Using-Cabal-during-development-tp27515446p27544307.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list