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/simplCore/should_run | |
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/simplCore/should_run')
-rw-r--r-- | testsuite/tests/simplCore/should_run/T13429a.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/testsuite/tests/simplCore/should_run/T13429a.hs b/testsuite/tests/simplCore/should_run/T13429a.hs index 6a838cb79c..718f26520a 100644 --- a/testsuite/tests/simplCore/should_run/T13429a.hs +++ b/testsuite/tests/simplCore/should_run/T13429a.hs @@ -5,6 +5,8 @@ {-# LANGUAGE UndecidableInstances #-} module T13429a where -- Orignally FingerTree.hs from the ticket +import Data.Semigroup (Semigroup(..)) + class (Monoid v) => Measured v a | a -> v where measure :: a -> v @@ -32,9 +34,11 @@ instance Foldable (FingerTree v) where foldMap f (Deep _ pr m sf) = foldMap f pr `mappend` foldMap (foldMap f) m `mappend` foldMap f sf +instance Measured v a => Semigroup (FingerTree v a) where + (<>) = (><) + instance Measured v a => Monoid (FingerTree v a) where mempty = empty - mappend = (><) empty :: Measured v a => FingerTree v a empty = Empty |