Re: Testing and module export lists

From: Magnus Therning
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

For what it's worth, Erlang addresses this issue with an -export_all directive, which can be passed as a compiler option.
participants (2)
-
John Lato
-
Richard O'Keefe