[Haskell-cafe] Maintaining test-suite dependencies with cabal

Bram Neijt bneijt at gmail.com
Fri Aug 22 16:49:22 UTC 2014


Dear reader,

I have a single executable package in Cabal[1] and I have added a test
for it using an example configuration from the ltc package[2].

With my test on my executable I can't depend on the main package, but
I seem to have to repeat the dependencies of my executable, or split
off functionality into a library. [3]

Can I easily depend on the dependencies of another package or should I
create a library  and depend on that in my test and executable?

All source is at: https://github.com/bneijt/after/

Greetings,

Bram

[1] https://github.com/bneijt/after/blob/master/after.cabal
[2] https://github.com/scvalex/ltc/blob/master/ltc.cabal
[3] A part of my cabal file added below

executable after
    main-is:            Main.hs
    build-depends:      base >=4.7 && <4.8,
                        options ==1.*,
                        directory ==1.2.*,
                        parallel-io ==0.3.*,
                        filepath ==1.3.*,
                        unix ==2.7.*
    hs-source-dirs:     src
    ghc-options:        -Wall
    default-language:   Haskell2010


test-suite afterTests
    hs-source-dirs:    test src
    main-is:           AfterTest.hs
    type:              exitcode-stdio-1.0
    build-depends:     base >=4.7 && <4.8,
                       unix ==2.7.*, -- Here because of after depending on it
                       directory ==1.2.*, -- Here because of after
depending on it
                       filepath ==1.3.*, -- Here because of after
depending on it
                       test-framework,
                       test-framework-hunit,
                       HUnit
    default-language:  Haskell2010


More information about the Haskell-Cafe mailing list