Search code examples
haskellcabal

Which cabal packages aren't being used


If I crank up the warnings with GHC, it will warn me which imports aren't being used....

Is there a similar command to tell me which build-depends aren't being used in my <project>.cabal file?


Solution

  • packunused is a simple CLI tool allows to find out which of the packages listed as build-depends in a Cabal package description file are redundant.

    You have to build your project with -ddump-minimal-imports then run packunused:

    cabal build --ghc-option=-ddump-minimal-imports
    packunused
    

    It will print a list of package dependencies that seem to be unused.