Skip to content

-Wunused-packages: not working with base-noprelude

Summary

Using -Wunused-packages with base-noprelude + custom Prelude results in incorrect warning that base-noprelude is not needed for compilation.

Steps to reproduce

  1. git clone git@github.com:AlistairB/unused-packages-repro.git
  2. cd unused-packages-repro
  3. cabal build

Warning is emitted by ghc:

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - base-noprelude-4.14.1.0

Expected behavior

No warning should be emitted as base-noprelude is required.

Removing base-noprelude from build-depends in the cabal file results in compilation failures due to missing modules as expected.

Environment

  • GHC version used: 8.10.4
  • Cabal version: 3.4

Optional:

  • Operating System: Ubuntu 20.10
  • System Architecture: x86
Edited by Alistair Burrowes
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information