Open metaleap opened 7 years ago
Sorry for the delay.
First, does dead-code-detection find stuff that GHC's -Wall (eg. -Wunused-local-binds, ...) doesn't?
Yes. ghc
only reasons about usage of identifiers on a module-by-module basis. So if you have an identifier that is declared in a module and not exported, ghc
will warn you, if it isn't used in that module. If you have an identifier that is exported, then ghc
will just assume that it might be used in another module and will not warn you, regardless of whether it's actually used in another module or not.
dead-code-detection
actually looks at all modules in the source directories and finds identifiers that are globally unused.
For your other questions: Yes, your guesses about -i
and --source-dirs
are right. -e
is an alias for --ignore
and allows to pass file names that the tool will then not look at. --root
has to be used to specify the entry point(s) of your project and has to be given as module names. So for executables it's usually --root Main
. Everything that is accessible -- directly or transitively -- from your root modules, will be considered live code, everything else is dead.
We should
-Wunused-local-binds
,--help
output.I'll keep this issue open for this.
First, does
dead-code-detection
find stuff that GHC's-Wall
(eg.-Wunused-local-binds
, ...) doesn't?Secondly, this is the current
--help
text:I get what
-i
is (I think, ie. usuallysrc
), and reckon--source-dirs
is an alias for same. What's-e
though, same as--ignore
? What gets ignored, identifier names? Module names? Source files?--root
is prepended to each source-dir to find specified modules? Even after--help
I'm left guessing as of now ;) thanks!