summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorchessai <chessai1996@gmail.com>2018-12-26 12:12:37 -0500
committerBen Gamari <ben@smart-cactus.org>2019-01-06 07:27:09 -0500
commitc121e33f9b039acf2ac6939af8bfafe593560039 (patch)
treebb61fb561f3fce2c0f5d8d90884e76d5297bc609 /docs
parent08b8ea2f4f1bbc1c61a7cca03ae7fa8ffb099556 (diff)
downloadhaskell-c121e33f9b039acf2ac6939af8bfafe593560039.tar.gz
Add -Wmissing-deriving-strategies
Warn users when -XDerivingStrategies is enabled but not used, at each potential use site. add -Wmissing-deriving-strategies Reviewers: bgamari, RyanGlScott Subscribers: andrewthad, rwbarton, carter GHC Trac Issues: #15798 Differential Revision: https://phabricator.haskell.org/D5451
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/8.8.1-notes.rst4
-rw-r--r--docs/users_guide/extending_ghc.rst1
-rw-r--r--docs/users_guide/using-warnings.rst21
3 files changed, 26 insertions, 0 deletions
diff --git a/docs/users_guide/8.8.1-notes.rst b/docs/users_guide/8.8.1-notes.rst
index 69d539748d..cd4c00d1a4 100644
--- a/docs/users_guide/8.8.1-notes.rst
+++ b/docs/users_guide/8.8.1-notes.rst
@@ -84,6 +84,10 @@ Compiler
- The deprecated ghc-flag ``-Wamp`` has been removed.
+- Add new :ghc-flag:`-Wmissing-deriving-strategies` flag that warns users when they are not
+ taking advantage of :extension:`DerivingStrategies`. The warning is supplied at each
+ ``deriving`` site.
+
Runtime system
~~~~~~~~~~~~~~
diff --git a/docs/users_guide/extending_ghc.rst b/docs/users_guide/extending_ghc.rst
index a913684a15..02847c9b86 100644
--- a/docs/users_guide/extending_ghc.rst
+++ b/docs/users_guide/extending_ghc.rst
@@ -851,6 +851,7 @@ In general, the ``pluginRecompile`` field has the following type::
The ``PluginRecompile`` data type is an enumeration determining how the plugin
should affect recompilation. ::
+
data PluginRecompile = ForceRecompile | NoForceRecompile | MaybeRecompile Fingerprint
A plugin which declares itself impure using ``ForceRecompile`` will always
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 6a6166bf0d..03ca184531 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -904,6 +904,27 @@ of ``-W(no-)*``.
This option isn't enabled by default because it can be very noisy,
and it often doesn't indicate a bug in the program.
+.. ghc-flag:: -Wmissing-deriving-strategies
+ :shortdesc: warn when a deriving clause is missing a deriving strategy
+ :type: dynamic
+ :reverse: -Wno-missing-deriving-strategies
+ :category:
+
+ :since: 8.8.1
+
+ The datatype below derives the ``Eq`` typeclass, but doesn't specify a
+ strategy. When :ghc-flag:`-Wmissing-deriving-strategies` is enabled,
+ the compiler will emit a warning about this. ::
+
+ data Foo a = Foo a
+ deriving (Eq)
+
+ The compiler will warn here that the deriving clause doesn't specify a
+ strategy. If the warning is enabled, but :extension:`DerivingStrategies` is
+ not enabled, the compiler will suggest turning on the
+ :extension:`DerivingStrategies` extension. This option is not on by default,
+ having to be turned on manually or with :ghc-flag:`-Weverything`.
+
.. ghc-flag:: -Wmissing-fields
:shortdesc: warn when fields of a record are uninitialised
:type: dynamic