Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eliminating repetition in cabal files

Tags:

haskell

cabal

I often have similar properties in many stanzas of my .cabal files. E.g.

Library x     ...     ghc-options:        -O2 -Wall -fno-warn-missing-signatures -fwarn-incomplete-patterns        -fno-warn-name-shadowing  Executable y     ...     ghc-options:        -O2 -Wall -fno-warn-missing-signatures -fwarn-incomplete-patterns        -fno-warn-name-shadowing 

Keeping them consistent is tedious and error-prone. Is there a better way?

Even trickier is when the fields are similar but not exactly the same e.g. when I have several executables which have common build dependencies but small variations.

like image 914
daf Avatar asked Mar 02 '13 20:03

daf


2 Answers

I think that cabal does not provide that functionality. I've also wondered about this some time ago. You can see my comment on Johan Tibell's blog as well as Johan's answer to it.

like image 111
Jan Stolarek Avatar answered Oct 26 '22 23:10

Jan Stolarek


I have written a tool to make it easier to specify Cabal files in Haskell, which helps deal with this issue and a few others.

https://hackage.haskell.org/package/cartel

like image 29
Omari Norman Avatar answered Oct 26 '22 23:10

Omari Norman