summaryrefslogtreecommitdiff
path: root/docs/users_guide/using-warnings.rst
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-03-01 16:13:44 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-03-04 10:41:29 +0000
commit7692da45af5f6e8f8b6bb0d55e2fe9d43779dc11 (patch)
tree59de5c255e8b65e42e07fed17ec17360fb289e40 /docs/users_guide/using-warnings.rst
parentc534b3dd30de8d5a59ff64628a6a0b3eb938a102 (diff)
downloadhaskell-wip/unused-package.tar.gz
Fix behaviour of -Wunused-packages in ghciwip/unused-package
Ticket #21110 points out that -Wunused-packages behaves a bit unusually in GHCi. Now we define the semantics for -Wunused-packages in interactive mode as follows: * If you use -Wunused-packages on an initial load then the warning is reported. * If you explicitly set -Wunused-packages on the command line then the warning is displayed (until it is disabled) * If you then subsequently modify the set of available targets by using :load or :cd (:cd unloads everything) then the warning is (silently) turned off. This means that every :r the warning is printed if it's turned on (but you did ask for it). Fixes #21110
Diffstat (limited to 'docs/users_guide/using-warnings.rst')
-rw-r--r--docs/users_guide/using-warnings.rst14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 5b0093b650..cad98bb4da 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -2083,7 +2083,7 @@ of ``-W(no-)*``.
data Foo = Foo { f :: Int } | Bar
.. ghc-flag:: -Wunused-packages
- :shortdesc: warn when package is requested on command line, but was never loaded.
+ :shortdesc: warn when package is requested on command line, but not needed.
:type: dynamic
:reverse: -Wno-unused-packages
:category:
@@ -2092,11 +2092,15 @@ of ``-W(no-)*``.
The option :ghc-flag:`-Wunused-packages` warns about packages, specified on
command line via :ghc-flag:`-package ⟨pkg⟩` or
- :ghc-flag:`-package-id ⟨unit-id⟩`, but were not loaded during compilation.
- Usually it means that you have an unused dependency.
+ :ghc-flag:`-package-id ⟨unit-id⟩`, but were not needed during compilation.
+ If the warning fires it means the specified package wasn't needed for
+ compilation.
+
+ This warning interacts poorly with GHCi because most invocations will pass
+ a large number of ``-package`` arguments on the initial load. Therefore if
+ you modify the targets using ``:load`` or ``:cd`` then the warning will be
+ silently disabled if it's enabled (see :ghc-ticket:`21110`).
- You may want to enable this warning on a clean build or enable :ghc-flag:`-fforce-recomp`
- in order to get reliable results.
.. ghc-flag:: -Winvalid-haddock
:shortdesc: warn when a Haddock comment occurs in an invalid position