How to reduce duplication in the build-depends fields of a .cabal file?

前端 未结 5 1955
深忆病人
深忆病人 2020-12-04 15:33

Here\'s a .cabal file:

Name:                myprogram
Version:             0.1
-- blah blah blah
Cabal-version:       >=1.9.2

Executable myprogram
  HS-s         


        
5条回答
  •  执笔经年
    2020-12-04 15:47

    No easy way:

    • you can use m4 and specify your dependencies once, but then you will need to reprocess your Cabal file through m4 whenever you change it.

    • you can move the code you are testing out to a library, and then specify the library in your Build-depends for the test. That requires you to install a library even just to run the test.

    • You can just not put the test in the cabal file at all. Build it with ghc --make, which will pull in dependencies. But then you lose cabal integration.

提交回复
热议问题