Integrate dead-code-detection (whole project usage analysis)
https://github.com/soenkehahn/dead-code-detection
Okay so GHC doesn't do cross module usage analysis apparently. So say you have some modules:
module Main where
import A
main = print foo
foo = bar
module A where
bar = 123
baz = 456
then ghc will not complain about baz but dead-code-detection will.
I'm not sure how/if this would work with libraries but I think give than we have knowledge of all components in Cabal package we could extend this thing to do cross component usage analysis too!
I.e. if a library defines and exports something but no other component in the package uses it. This doesn't really make sense as something you complain about all the time but it's a sort of nice-to-have for library writers to check manually for any dead code they may simply have forgotten about.
I think the person initiating dead-code checks will have to somehow define the unit of compilation to be checked. Or maybe even a set of things being compiled.
Agreed