Starting with Cabal 2.0, you can put the general code in the named “internal library”, on which both the test suite and the standard depend. According to the documentation :
Cabal 2.0 " ", ( ). , , , . , .
:
library foo-internal
exposed-modules: Foo.Internal
build-depends: base
, .
(, ) ( ).
cabal-version: >=2
.cabal
.