diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2017-09-05 07:29:36 +0200 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2017-09-07 23:43:53 +0200 |
commit | 8ae263ceb3566a7c82336400b09cb8f381217405 (patch) | |
tree | 535775c4f739cd23bd443557f2d8f8b939cf711e /testsuite/tests/wcompat-warnings | |
parent | 055d73c6576bed2affaf96ef6a6b89aeb2cd2e9f (diff) | |
download | haskell-8ae263ceb3566a7c82336400b09cb8f381217405.tar.gz |
Make Semigroup a superclass of Monoid (re #14191)
Unfortunately, this requires introducing a couple of .hs-boot files to
break up import cycles (mostly to provide class & typenames in order to
be able to write type signatures).
This does not yet re-export `(<>)` from Prelude (while the class-name
`Semigroup` is reexported); that will happen in a future commit.
Test Plan: local ./validate passed
Reviewers: ekmett, austin, bgamari, erikd, RyanGlScott
Reviewed By: ekmett, RyanGlScott
GHC Trac Issues: #14191
Differential Revision: https://phabricator.haskell.org/D3927
Diffstat (limited to 'testsuite/tests/wcompat-warnings')
5 files changed, 5 insertions, 5 deletions
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs index 64a19e5cf9..707e153a8d 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs @@ -21,6 +21,6 @@ newtype S = S Int instance Semi.Semigroup S where (<>) = mappend -instance Semi.Monoid S where +instance Monoid S where S a `mappend` S b = S (a+b) mempty = S 0 diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs index 6ed25f1ef7..777c11cd70 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs @@ -21,6 +21,6 @@ newtype S = S Int instance Semi.Semigroup S where (<>) = mappend -instance Semi.Monoid S where +instance Monoid S where S a `mappend` S b = S (a+b) mempty = S 0 diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs index c155f37f42..6d67ed039f 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs @@ -21,6 +21,6 @@ newtype S = S Int instance Semi.Semigroup S where (<>) = mappend -instance Semi.Monoid S where +instance Monoid S where S a `mappend` S b = S (a+b) mempty = S 0 diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr index 571a24119a..c62780f0b7 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr @@ -26,7 +26,7 @@ WCompatWarningsOn.hs:16:1: warning: [-Wsemigroup (in -Wcompat)] WCompatWarningsOn.hs:22:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)] Noncanonical ‘(<>) = mappend’ definition detected - in the instance declaration for ‘Semi.Semigroup S’. + in the instance declaration for ‘Semigroup S’. Move definition from ‘mappend’ to ‘(<>)’ WCompatWarningsOn.hs:25:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)] diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs index 44f554ee47..e6a4aa3efb 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs @@ -21,6 +21,6 @@ newtype S = S Int instance Semi.Semigroup S where (<>) = mappend -instance Semi.Monoid S where +instance Monoid S where S a `mappend` S b = S (a+b) mempty = S 0 |