summaryrefslogtreecommitdiff
path: root/docs/users_guide/using-warnings.rst
diff options
context:
space:
mode:
authorMatthew Yacavone <matthew@yacavone.net>2018-10-27 14:01:42 -0400
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-10-27 14:54:56 -0400
commit512eeb9bb9a81e915bfab25ca16bc87c62252064 (patch)
tree803e752c6907fdfc89a5f71e6bfda04d7ef86bea /docs/users_guide/using-warnings.rst
parent23956b2ada690c78a134fe6d149940c777c7efcc (diff)
downloadhaskell-512eeb9bb9a81e915bfab25ca16bc87c62252064.tar.gz
More explicit foralls (GHC Proposal 0007)
Allow the user to explicitly bind type/kind variables in type and data family instances (including associated instances), closed type family equations, and RULES pragmas. Follows the specification of GHC Proposal 0007, also fixes #2600. Advised by Richard Eisenberg. This modifies the Template Haskell AST -- old code may break! Other Changes: - convert HsRule to a record - make rnHsSigWcType more general - add repMaybe to DsMeta Includes submodule update for Haddock. Test Plan: validate Reviewers: goldfire, bgamari, alanz Subscribers: simonpj, RyanGlScott, goldfire, rwbarton, thomie, mpickering, carter GHC Trac Issues: #2600, #14268 Differential Revision: https://phabricator.haskell.org/D4894
Diffstat (limited to 'docs/users_guide/using-warnings.rst')
-rw-r--r--docs/users_guide/using-warnings.rst20
1 files changed, 14 insertions, 6 deletions
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index f603a4cf28..f0c4ac4fd5 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -1503,7 +1503,7 @@ of ``-W(no-)*``.
do { mapM_ popInt xs ; return 10 }
.. ghc-flag:: -Wunused-type-patterns
- :shortdesc: warn about unused type variables which arise from patterns
+ :shortdesc: warn about unused type variables which arise from patterns in
in type family and data family instances
:type: dynamic
:reverse: -Wno-unused-type-patterns
@@ -1513,22 +1513,30 @@ of ``-W(no-)*``.
single: unused type patterns, warning
single: type patterns, unused
- Report all unused type variables which arise from patterns in type family
- and data family instances. For instance: ::
+ Report all unused implicitly bound type variables which arise from
+ patterns in type family and data family instances. For instance: ::
type instance F x y = []
- would report ``x`` and ``y`` as unused. The warning is suppressed if the
- type variable name begins with an underscore, like so: ::
+ would report ``x`` and ``y`` as unused on the right hand side. The warning
+ is suppressed if the type variable name begins with an underscore, like
+ so: ::
type instance F _x _y = []
+ 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
not implied by :ghc-flag:`-Wall`. The rationale for this decision is that
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