Function privacy and unit testing Haskell
问题 How do you deal with function visibility and unit testing in Haskell? If you export every function in a module so that the unit tests have access to them, you risk other people calling functions that should not be in the public API. I thought of using {-# LANGUAGE CPP #-} and then surrounding the exports with an #ifdef : {-# LANGUAGE CPP #-} module SomeModule #ifndef TESTING ( export1 , export2 ) #endif where Is there a better way? 回答1: The usual convention is to split your module into public