summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2019-02-11 09:24:04 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-02-14 02:36:02 -0500
commit19626218566ea709b5f6f287d3c296b0c4021de2 (patch)
treed22f486e543a19670be2ae88e8e358f99e1e54fd /docs/users_guide
parent1d9a1d9fb8fe0a1fea2c44c4246f102ff3e1f3a3 (diff)
downloadhaskell-19626218566ea709b5f6f287d3c296b0c4021de2.tar.gz
Implement -Wredundant-record-wildcards and -Wunused-record-wildcards
-Wredundant-record-wildcards warns when a .. pattern binds no variables. -Wunused-record-wildcards warns when none of the variables bound by a .. pattern are used. These flags are enabled by `-Wall`.
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/8.10.1-notes.rst45
-rw-r--r--docs/users_guide/using-warnings.rst50
2 files changed, 92 insertions, 3 deletions
diff --git a/docs/users_guide/8.10.1-notes.rst b/docs/users_guide/8.10.1-notes.rst
new file mode 100644
index 0000000000..cf67246abf
--- /dev/null
+++ b/docs/users_guide/8.10.1-notes.rst
@@ -0,0 +1,45 @@
+.. _release-8-10-1:
+
+Release notes for version 8.10.1
+===============================
+
+The significant changes to the various parts of the compiler are listed in the
+following sections.
+
+
+Highlights
+----------
+
+Full details
+------------
+
+Language
+~~~~~~~~
+
+Compiler
+~~~~~~~~
+
+- Add new flags :ghc-flag:`-Wunused-record-wildcards` and
+ :ghc-flag:`-Wredundant-record-wildcards` which warn users when they have
+ redundant or unused uses of a record wildcard match.
+
+Runtime system
+~~~~~~~~~~~~~~
+
+Template Haskell
+~~~~~~~~~~~~~~~~
+
+``ghc-prim`` library
+~~~~~~~~~~~~~~~~~~~~
+
+``ghc`` library
+~~~~~~~~~~~~~~~
+
+``base`` library
+~~~~~~~~~~~~~~~~
+
+Build system
+~~~~~~~~~~~~
+
+Included libraries
+------------------
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 03ca184531..c392ab38df 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -1565,9 +1565,9 @@ of ``-W(no-)*``.
When :extension:`ExplicitForAll` is enabled, explicitly quantified type
variables may also be identified as unused. For instance: ::
-
+
type instance forall x y. F x y = []
-
+
would still report ``x`` and ``y`` as unused on the right hand side
Unlike :ghc-flag:`-Wunused-matches`, :ghc-flag:`-Wunused-type-patterns` is
@@ -1575,7 +1575,7 @@ of ``-W(no-)*``.
unlike term-level pattern names, type names are often chosen expressly for
documentation purposes, so using underscores in type names can make the
documentation harder to read.
-
+
.. ghc-flag:: -Wunused-foralls
:shortdesc: warn about type variables in user-written
``forall``\\s that are unused
@@ -1594,6 +1594,50 @@ of ``-W(no-)*``.
would report ``a`` and ``c`` as unused.
+.. ghc-flag:: -Wunused-record-wildcards
+ :shortdesc: Warn about record wildcard matches when none of the bound variables
+ are used.
+ :type: dynamic
+ :since: 8.10.1
+ :reverse: -Wno-unused-record-wildcards
+ :category:
+
+ .. index::
+ single: unused, warning, record wildcards
+
+ Report all record wildcards where none of the variables bound implicitly
+ are used. For instance: ::
+
+
+ data P = P { x :: Int, y :: Int }
+
+ f1 :: P -> Int
+ f1 P{..} = 1 + 3
+
+ would report that the ``P{..}`` match is unused.
+
+.. ghc-flag:: -Wredundant-record-wildcards
+ :shortdesc: Warn about record wildcard matches when the wildcard binds no patterns.
+ :type: dynamic
+ :since: 8.10.1
+ :reverse: -Wno-redundant-record-wildcards
+ :category:
+
+ .. index::
+ single: unused, warning, record wildcards
+
+ Report all record wildcards where the wild card match binds no patterns.
+ For instance: ::
+
+
+ data P = P { x :: Int, y :: Int }
+
+ f1 :: P -> Int
+ f1 P{x,y,..} = x + y
+
+ would report that the ``P{x, y, ..}`` match has a redundant use of ``..``.
+
+
.. ghc-flag:: -Wwrong-do-bind
:shortdesc: warn about do bindings that appear to throw away monadic values
that you should have bound instead