diff options
author | David Luposchainsky <dluposchainsky@gmail.com> | 2015-11-29 22:59:57 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-11-29 23:00:48 +0100 |
commit | 290def72f54db7969258b4541aaefc87b54ce448 (patch) | |
tree | 5843028d9666626e3becb897e21e8caa007fd8c2 /docs | |
parent | bcd55a94f234f5efa4bb4fd24429dafc79d93106 (diff) | |
download | haskell-290def72f54db7969258b4541aaefc87b54ce448.tar.gz |
Implement warnings for Semigroups as parent of Monoid
This patch is similar to the AMP patch (#8004), which offered two
functions:
1. Warn when an instance of a class has been given, but the type does
not have a certain superclass instance
2. Warn when top-level definitions conflict with future Prelude names
These warnings are issued as part of the new `-Wcompat` warning group.
Reviewers: hvr, ekmett, austin, bgamari
Reviewed By: hvr, ekmett, bgamari
Subscribers: ekmett, thomie
Differential Revision: https://phabricator.haskell.org/D1539
GHC Trac Issues: #11139
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/7.12.1-notes.rst | 6 | ||||
-rw-r--r-- | docs/users_guide/using-warnings.rst | 18 |
2 files changed, 23 insertions, 1 deletions
diff --git a/docs/users_guide/7.12.1-notes.rst b/docs/users_guide/7.12.1-notes.rst index dfc5bb361b..2e0ae6f18c 100644 --- a/docs/users_guide/7.12.1-notes.rst +++ b/docs/users_guide/7.12.1-notes.rst @@ -164,6 +164,12 @@ Compiler `MonadFail Proposal (MFP) <https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail>`__. +- Added the ``-fwarn-semigroup`` flag. When enabled, this + will issue a warning if a type is an instance of ``Monoid`` but not + ``Semigroup``, and when a custom definition ``(<>)`` is made. Fixing these + warnings makes sure the definition of ``Semigroup`` as a superclass of + ``Monoid`` does not break any code. + GHCi ~~~~ diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index 4c2bc88710..deb0e5459d 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -54,7 +54,8 @@ standard “packages” of warnings: eager to make their code future compatible to adapt to new features before they even generate warnings. - This currently enables only ``-fwarn-missing-monadfail-instance``. + This currently enables ``-fwarn-missing-monadfail-instance`` and + ``-fwarn-semigroup``. ``-Wno-compat`` .. index:: @@ -245,6 +246,21 @@ command line. the `MonadFail Proposal (MFP) <https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail>`__. +``-fwarn-semigroup`` + .. index:: + single: -fwarn-semigroup + single: semigroup + + Warn when definitions are in conflict with the future inclusion of + ``Semigroup`` into the standard typeclasses. + + 1. Instances of ``Monoid`` should also be instances of ``Semigroup`` + 2. The ``Semigroup`` operator ``(<>)`` will be in ``Prelude``, which + clashes with custom local definitions of such an operator + + Being part of the ``-Wcompat`` option group, this warning is off by + default, but will be switched on in a future GHC release. + ``-fwarn-deprecated-flags`` .. index:: single: -fwarn-deprecated-flags |