diff options
| author | Evan Rutledge Borden <eborden@frontrowed.com> | 2017-11-21 18:06:01 -0500 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2017-11-21 21:11:16 -0500 |
| commit | 63e4ac37d7268e063cb6adcea89e1e8716c5de89 (patch) | |
| tree | 3d0a04ae40369f660f131e16a3708719adcd1b4a /docs | |
| parent | f376ebac29d8dab023482a21ecfbc4dc032ab23e (diff) | |
| download | haskell-63e4ac37d7268e063cb6adcea89e1e8716c5de89.tar.gz | |
Add warn-missing-export-lists
Many industrial users have aligned around the idea that implicit exports
are an anti-pattern. They lead to namespace pollution and byzantine
naming schemes. They also prevent GHC's dead code analysis and create
more obstacles to optimization. This warning allows teams/projects to
warn on or enforce via -Werror explicit export lists.
This warning also serves as a complement to warn-missing-import-lists.
This was originally discussed here:
https://github.com/ghc-proposals/ghc-proposals/pull/93
Test Plan: Three new minimal tests have been added to the type checker.
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4197
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/users_guide/8.4.1-notes.rst | 3 | ||||
| -rw-r--r-- | docs/users_guide/using-warnings.rst | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/docs/users_guide/8.4.1-notes.rst b/docs/users_guide/8.4.1-notes.rst index 103559cedd..1acab73693 100644 --- a/docs/users_guide/8.4.1-notes.rst +++ b/docs/users_guide/8.4.1-notes.rst @@ -108,6 +108,9 @@ Language Compiler ~~~~~~~~ +- Add warning flag :ghc-flag:`-Wmissing-export-lists` which causes the type + checker to warn when a module does not include an explicit export list. + - The ``configure`` script now no longer accepts ``--with-TOOL`` flags (e.g. ``--with-nm``, ``--with-ld``, etc.). Instead, these are taken from environment variables, as is typical in ``autoconf`` scripts. For instance, diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index c6a86bbb71..cf41c283ab 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -74,6 +74,7 @@ The following flags are simple ways to select standard "packages" of warnings: * :ghc-flag:`-Wimplicit-prelude` * :ghc-flag:`-Wmissing-local-signatures` * :ghc-flag:`-Wmissing-exported-signatures` + * :ghc-flag:`-Wmissing-export-lists` * :ghc-flag:`-Wmissing-import-lists` * :ghc-flag:`-Wmissing-home-modules` * :ghc-flag:`-Widentities` @@ -858,6 +859,31 @@ of ``-W(no-)*``. fields are initialised with bottoms), it is often an indication of a programmer error. +.. ghc-flag:: -Wmissing-export-lists + :shortdesc: warn when a module declaration does not explicitly list all + exports + :type: dynamic + :reverse: -fnowarn-missing-export-lists + :category: + + :since: 8.4.1 + + .. index:: + single: missing export lists, warning + single: export lists, missing + + This flag warns if you declare a module without declaring an explicit + export list. For example :: + + module M where + + p x = x + + The :ghc-flag:`-Wmissing-export-lists` flag will warn that ``M`` does not + declare an export list. Declaring an explicit export list for ``M`` enables + GHC dead code analysis, prevents accidental export of names and can ease + optimizations like inlining. + .. ghc-flag:: -Wmissing-import-lists :shortdesc: warn when an import declaration does not explicitly list all the names brought into scope |
