A library is in src-directory and there is a data definition A. Code related to testing is in test-directory, as suggested in many tutorials, and that includes Serial instance to generate the test cases, see links below:
instance Monad m => Serial m A where ...
cabal test
warns that this is an orphan instance. Is this unavoidable or is there an established convention to organize libs, e.g., move serial instance definition to where data A is defined? The latter one somehow feels a bit wrong as it would be nice to keep testing related stuff at test-directory. If this is typical way, in what ways one can avoid exposing the testing related stuff at the public interface? Write 'internal' version of all tested modules (that the public ones and the actual testing program would use)? Something similar was suggested in unit-testing question.
Or does this matter at all? How bad convention it is to leave orphan instances in testing related code?