BSD-3-Clause licensed by Herbert Valerio Riedel
This version can be pinned in stack with:packunused-0.1.2@sha256:a79a9f4dc4c0e5e8f7bbf2a7406b581b0986ac49b05dc67f0adef53ed758f2d7,3441

Module documentation for 0.1.2

There are no documented modules for this package.

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

packunused works by taking advantage of GHC's -ddump-minimal-imports feature which creates .import files for each compiled module containing a minimal set of explicit import declarations. These .import files together with Cabal's generated package configuration meta-data is analyzed by packunused to detect potentially redundant package dependencies.

In order to use packunused you have to configure the package as usual. See the example session below:

cabal clean
rm *.imports
cabal configure -O0 --disable-library-profiling
cabal build --ghc-option=-ddump-minimal-imports
packunused

Experimental support for stack:

stack setup --upgrade-cabal  # necessary only when stack's global Cabal installation is out of date
stack clean
stack build --ghc-options '-ddump-minimal-imports -O0'
packunused

The -O0 --disable-library-profiling options are just to speed up compilation. In some cases you might want to pass additional options to the configure step, such as --enable-benchmark or --enable-tests.

When run, packunused prints a report to standard output listing its findings for each component built. The following is an example for the packunused package itself, with a redundant dependency added for demonstration on purpose:

detected package components
~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - executable(s): packunused

(component names suffixed with '*' are not configured to be built)

executable(packunused)
~~~~~~~~~~~~~~~~~~~~~~

The following package dependencies seem redundant:

 - criterion-0.6.2.0-9dd4d764629a47662168743b2dfda9bc

Changes

0.1.2

  • Add support for Cabal-1.24 (and drop support for previous Cabal versions)
  • Add experimental support for Stack

0.1.1.4

  • Add support for Cabal-1.22.* and base-4.8.*

0.1.1.3

  • Allow optparse-applicative-0.11.* and haskell-src-exts-1.16.*

0.1.1.2

  • New option --ignore-package to white-list redundant packages by name
  • Exit with a non-zero status code if (non-ignored) redundant dependencies are found
  • Fake support for parsing -XSafeHaskell and -XExplicitNamespaces in .imports files
  • Switched from cmdargs to optparse-applicative

0.1.1.1

  • Minor typo in output messages fixed

0.1.1.0

  • Update to support Cabal-1.18/Cabal-1.20, GHC 7.8.1+, and haskell-src-exts-1.15

0.1.0.1

  • Add support for haskell-src-exts-1.14.0

0.1.0.0

  • Initial release