[Haskell-cafe] Re: Testing and module export lists
John Lato
jwlato at gmail.com
Wed Feb 24 06:21:50 EST 2010
> From: Magnus Therning <magnus at therning.org>
>
> How do people who like unit testing / property testing deal with export lists?
>
> I often find that I do want an export list to reduce clutter in the
> finished code, but for testing I'd like to expose everything in a
> module. Is there a nice way to deal with this (using the C
> pre-processor would not qualify as "nice" ;-)?
> Maybe there's a switch that causes GHC to simply ignore the export
> list of a module and export everything?
That would be a nice feature to deal with this problem.
The best solution I have is to separate functions that don't belong in
the public interface into separate modules that aren't exposed
(they're listed in the other-modules section of the .cabal file). I
then add the test executable to the .cabal file, so when it's built it
can access the hidden modules (or I run the test from ghci).
Of course this only works if it makes sense to structure the code this way.
Cheers,
John
More information about the Haskell-Cafe
mailing list