diff options
| author | Kari Pahula <kaol@iki.fi> | 2019-09-24 16:33:15 +0300 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-25 13:52:48 -0400 |
| commit | 2970dc7ab95f7daa793112c6a4a682263561761c (patch) | |
| tree | bcbc7c565479441427e5e512b6c71d85ce6d497e /docs | |
| parent | 218c5dbfbd60a416588e1b952c167ebd18ef9c56 (diff) | |
| download | haskell-2970dc7ab95f7daa793112c6a4a682263561761c.tar.gz | |
Add -Wderiving-defaults (#15839)
Enabling both DeriveAnyClass and GeneralizedNewtypeDeriving can cause
a warning when no explicit deriving strategy is in use. This change adds
an enable/suppress flag for it.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/users_guide/8.10.1-notes.rst | 10 | ||||
| -rw-r--r-- | docs/users_guide/using-warnings.rst | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/docs/users_guide/8.10.1-notes.rst b/docs/users_guide/8.10.1-notes.rst index 2ca9ce5c08..e8316d7059 100644 --- a/docs/users_guide/8.10.1-notes.rst +++ b/docs/users_guide/8.10.1-notes.rst @@ -90,6 +90,16 @@ Language for a ``newtype``. This was proposed in `GHC proposal #13 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0013-unlifted-newtypes.rst>`__. +- New flag :ghc-flag:`-Wderiving-defaults` that controls a warning + message when both :extension:`DeriveAnyClass` and + :extension:`GeneralizedNewtypeDeriving` are enabled and no explicit + deriving strategy is in use. The warning is enabled by default and + has been present in earlier GHC versions but without the option of + disabling it. For example, this code would trigger the warning: :: + + class C a + newtype T a = MkT a deriving C + Compiler ~~~~~~~~ diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index dda7bb656c..31060d701d 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -26,6 +26,7 @@ generally likely to indicate bugs in your program. These are: * :ghc-flag:`-Wdeprecated-flags` * :ghc-flag:`-Wunrecognised-pragmas` * :ghc-flag:`-Wduplicate-exports` + * :ghc-flag:`-Wderiving-defaults` * :ghc-flag:`-Woverflowed-literals` * :ghc-flag:`-Wempty-enumerations` * :ghc-flag:`-Wmissing-fields` @@ -640,6 +641,23 @@ of ``-W(no-)*``. Causes a warning to be emitted if an enumeration is empty, e.g. ``[5 .. 3]``. +.. ghc-flag:: -Wderiving-defaults + :shortdesc: warn about default deriving when using both + DeriveAnyClass and GeneralizedNewtypeDeriving + :type: dynamic + :reverse: -Wno-deriving-defaults + :category: + + :since: 8.10 + + Causes a warning when both :ref:`DeriveAnyClass` and + :ref:`GeneralizedNewtypeDeriving` are enabled and no explicit + deriving strategy is in use. For example, this would result a + warning: :: + + class C a + newtype T a = MkT a deriving C + .. ghc-flag:: -Wduplicate-constraints :shortdesc: warn when a constraint appears duplicated in a type signature :type: dynamic |
