summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-03-01 16:13:44 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-23 13:41:31 -0400
commit4dc624987a7e000e9e1086a601039afafb7f2d28 (patch)
tree982838d1ec69844598069ebb225bbf2bd28ffba1 /docs
parentb06e5dd8a2b258d5d6f3676c9f424cc09d4d73f3 (diff)
downloadhaskell-4dc624987a7e000e9e1086a601039afafb7f2d28.tar.gz
Fix behaviour of -Wunused-packages in ghci
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')
-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 5b2c85099b..9eaf63ed80 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -2085,7 +2085,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:
@@ -2094,11 +2094,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