diff options
Diffstat (limited to 'docs/users_guide/using-warnings.rst')
-rw-r--r-- | docs/users_guide/using-warnings.rst | 50 |
1 files changed, 47 insertions, 3 deletions
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 |