[Haskell-cafe] Cabal and `main-is` field

Gwern Branwen gwern0 at gmail.com
Sun Mar 1 10:51:43 EST 2009


On Sun, Mar 1, 2009 at 10:45 AM, Manlio Perillo <manlio_perillo at libero.it> wrote:
> Hi.
...
> One last thing: is it possible to define "macros" in Cabal?
> In my package, I have n executables, that have many dependencies in common.
> I would like to avoid having to repeat the same dependencies for each
> executable block.
>
>
>
> Thanks   Manlio Perillo

You can hoist the common build-depends out of the executable stanzas. ie. from xmonad-utils.cabal:

build-depends:      base<4, X11>=1.3, ghc>=6.8, unix, random>=1.0
...
executable:         hxsel
main-is:            Hxsel.hs
hs-source-dirs:     src
ghc-options:        -funbox-strict-fields -Wall
ghc-prof-options:   -prof -auto-all

executable:         hxput
main-is:            Hxput.hs
hs-source-dirs:     src
ghc-options:        -funbox-strict-fields -Wall
ghc-prof-options:   -prof -auto-all
....

Notice that though hxput and hxsel need the packages in the top-level build-depends, they don't need to declare it.

-- 
gwern
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 270 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090301/245bb286/signature.bin


More information about the Haskell-Cafe mailing list