[Haskell-cafe] Cabal Testing Pain

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Tue Sep 30 02:32:42 UTC 2014


On 09/27/2014 10:54 PM, Mike Craig wrote:
> Hey all, I'm trying to setup an executable cabal project, the options for
> cabal-based testing seem poor. I poked around for discussions of this but
> didn't find much. My apologies if I'm beating a dead horse.
> 
> The current options, as I understand them, are
> 
> 1. Split code into library, executable, and test-suite. This gets you
> single compilation but you have to list every source file in the library's
> exposed/other-modules sections.
> 2. Split code into executable and test-suite. You don't have to list the
> source files, but you get double compilation and you have to declare every
> dependency (and version!) twice.
> 
> Am I missing a third (better) option, or is this the state of things?
> 
> --
> Mike Craig
> 
> 

1. is a fine option, it's not like you add 20 modules a minute. It's a
bit cumbersome at the beginning but that's about it. All other options
either greatly prolong compilation or make testing/shipping inconvenient.

2. is bad precisely because you end up hiding your library part. Not
only does it mean double compilation for you, there's nothing more
frustrating than finding a package on Hackage that does what you want
just to find it's executable-only.

-- 
Mateusz K.


More information about the Haskell-Cafe mailing list