summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/ghci/scripts/T10963.script4
-rw-r--r--testsuite/tests/ghci/scripts/T4175.stdout3
-rw-r--r--testsuite/tests/ghci/scripts/T7627.stdout3
-rw-r--r--testsuite/tests/ghci/scripts/T8535.stdout1
-rw-r--r--testsuite/tests/ghci/scripts/T9881.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/ghci011.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/ghci020.stdout1
-rw-r--r--testsuite/tests/ghci/should_run/T10145.stdout1
-rw-r--r--testsuite/tests/perf/compiler/all.T3
-rw-r--r--testsuite/tests/perf/should_run/T4978.hs7
-rw-r--r--testsuite/tests/polykinds/MonoidsFD.hs5
-rw-r--r--testsuite/tests/polykinds/MonoidsTF.hs8
-rw-r--r--testsuite/tests/polykinds/T7332.hs3
-rw-r--r--testsuite/tests/semigroup/Makefile3
-rw-r--r--testsuite/tests/semigroup/SemigroupWarnings.hs34
-rw-r--r--testsuite/tests/semigroup/SemigroupWarnings.stderr8
-rw-r--r--testsuite/tests/semigroup/all.T1
-rw-r--r--testsuite/tests/simplCore/should_run/T13429a.hs6
-rw-r--r--testsuite/tests/typecheck/should_run/T6117.hs2
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs2
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs2
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs2
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr2
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOnOff.hs2
24 files changed, 51 insertions, 60 deletions
diff --git a/testsuite/tests/ghci/scripts/T10963.script b/testsuite/tests/ghci/scripts/T10963.script
index 357d1256ba..2bba5b36ef 100644
--- a/testsuite/tests/ghci/scripts/T10963.script
+++ b/testsuite/tests/ghci/scripts/T10963.script
@@ -3,5 +3,7 @@
:t +d length
let foo :: (Num a, Monoid a) => a -> a; foo = undefined
:t +d foo
-instance Monoid Double where mempty = 0; mappend = (+)
+import Data.Semigroup
+instance Semigroup Double where (<>) = (+)
+instance Monoid Double where mempty = 0
:t +d foo
diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout
index 6f56a5f868..7b630f1ed9 100644
--- a/testsuite/tests/ghci/scripts/T4175.stdout
+++ b/testsuite/tests/ghci/scripts/T4175.stdout
@@ -21,6 +21,7 @@ instance C () -- Defined at T4175.hs:21:10
instance Eq () -- Defined in ‘GHC.Classes’
instance Monoid () -- Defined in ‘GHC.Base’
instance Ord () -- Defined in ‘GHC.Classes’
+instance Semigroup () -- Defined in ‘GHC.Base’
instance Show () -- Defined in ‘GHC.Show’
instance Read () -- Defined in ‘GHC.Read’
instance Enum () -- Defined in ‘GHC.Enum’
@@ -35,6 +36,8 @@ instance Functor Maybe -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
instance Monoid a => Monoid (Maybe a) -- Defined in ‘GHC.Base’
instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’
+instance Semigroup a => Semigroup (Maybe a)
+ -- Defined in ‘GHC.Base’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’
instance Foldable Maybe -- Defined in ‘Data.Foldable’
diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout
index c13a3f3ba0..ff4e67005e 100644
--- a/testsuite/tests/ghci/scripts/T7627.stdout
+++ b/testsuite/tests/ghci/scripts/T7627.stdout
@@ -2,6 +2,7 @@ data () = () -- Defined in ‘GHC.Tuple’
instance Eq () -- Defined in ‘GHC.Classes’
instance Monoid () -- Defined in ‘GHC.Base’
instance Ord () -- Defined in ‘GHC.Classes’
+instance Semigroup () -- Defined in ‘GHC.Base’
instance Show () -- Defined in ‘GHC.Show’
instance Read () -- Defined in ‘GHC.Read’
instance Enum () -- Defined in ‘GHC.Enum’
@@ -19,6 +20,8 @@ instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’
instance (Monoid a, Monoid b) => Monoid (a, b)
-- Defined in ‘GHC.Base’
instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’
+instance (Semigroup a, Semigroup b) => Semigroup (a, b)
+ -- Defined in ‘GHC.Base’
instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’
instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’
instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/scripts/T8535.stdout
index 3995bc0b20..873b992a38 100644
--- a/testsuite/tests/ghci/scripts/T8535.stdout
+++ b/testsuite/tests/ghci/scripts/T8535.stdout
@@ -4,3 +4,4 @@ instance Applicative ((->) a) -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
+instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
diff --git a/testsuite/tests/ghci/scripts/T9881.stdout b/testsuite/tests/ghci/scripts/T9881.stdout
index 18fa4d521f..68acea7c61 100644
--- a/testsuite/tests/ghci/scripts/T9881.stdout
+++ b/testsuite/tests/ghci/scripts/T9881.stdout
@@ -9,6 +9,8 @@ instance Monoid Data.ByteString.Lazy.ByteString
-- Defined in ‘Data.ByteString.Lazy.Internal’
instance Ord Data.ByteString.Lazy.ByteString
-- Defined in ‘Data.ByteString.Lazy.Internal’
+instance Semigroup Data.ByteString.Lazy.ByteString
+ -- Defined in ‘Data.ByteString.Lazy.Internal’
instance Show Data.ByteString.Lazy.ByteString
-- Defined in ‘Data.ByteString.Lazy.Internal’
instance Read Data.ByteString.Lazy.ByteString
@@ -26,6 +28,8 @@ instance Monoid Data.ByteString.ByteString
-- Defined in ‘Data.ByteString.Internal’
instance Ord Data.ByteString.ByteString
-- Defined in ‘Data.ByteString.Internal’
+instance Semigroup Data.ByteString.ByteString
+ -- Defined in ‘Data.ByteString.Internal’
instance Show Data.ByteString.ByteString
-- Defined in ‘Data.ByteString.Internal’
instance Read Data.ByteString.ByteString
diff --git a/testsuite/tests/ghci/scripts/ghci011.stdout b/testsuite/tests/ghci/scripts/ghci011.stdout
index 372930d66d..7bd58dcc24 100644
--- a/testsuite/tests/ghci/scripts/ghci011.stdout
+++ b/testsuite/tests/ghci/scripts/ghci011.stdout
@@ -5,6 +5,7 @@ instance Functor [] -- Defined in ‘GHC.Base’
instance Monad [] -- Defined in ‘GHC.Base’
instance Monoid [a] -- Defined in ‘GHC.Base’
instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’
+instance Semigroup [a] -- Defined in ‘GHC.Base’
instance Show a => Show [a] -- Defined in ‘GHC.Show’
instance Read a => Read [a] -- Defined in ‘GHC.Read’
instance Foldable [] -- Defined in ‘Data.Foldable’
@@ -13,6 +14,7 @@ data () = () -- Defined in ‘GHC.Tuple’
instance Eq () -- Defined in ‘GHC.Classes’
instance Monoid () -- Defined in ‘GHC.Base’
instance Ord () -- Defined in ‘GHC.Classes’
+instance Semigroup () -- Defined in ‘GHC.Base’
instance Show () -- Defined in ‘GHC.Show’
instance Read () -- Defined in ‘GHC.Read’
instance Enum () -- Defined in ‘GHC.Enum’
@@ -25,6 +27,8 @@ instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’
instance (Monoid a, Monoid b) => Monoid (a, b)
-- Defined in ‘GHC.Base’
instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’
+instance (Semigroup a, Semigroup b) => Semigroup (a, b)
+ -- Defined in ‘GHC.Base’
instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’
instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’
instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
diff --git a/testsuite/tests/ghci/scripts/ghci020.stdout b/testsuite/tests/ghci/scripts/ghci020.stdout
index 3995bc0b20..873b992a38 100644
--- a/testsuite/tests/ghci/scripts/ghci020.stdout
+++ b/testsuite/tests/ghci/scripts/ghci020.stdout
@@ -4,3 +4,4 @@ instance Applicative ((->) a) -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
+instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
diff --git a/testsuite/tests/ghci/should_run/T10145.stdout b/testsuite/tests/ghci/should_run/T10145.stdout
index 3995bc0b20..873b992a38 100644
--- a/testsuite/tests/ghci/should_run/T10145.stdout
+++ b/testsuite/tests/ghci/should_run/T10145.stdout
@@ -4,3 +4,4 @@ instance Applicative ((->) a) -- Defined in ‘GHC.Base’
instance Functor ((->) r) -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
+instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index d309f6c48a..7227ebfe52 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -1040,13 +1040,14 @@ test('T12234',
# initial: 83032768
# 2017-02-19 89180624 (x64/Windows) - Unknown
# 2017-02-25 79889200 (x64/Windows) - Early inline patch
- (wordsize(64), 80245640, 5),
+ (wordsize(64), 81696664, 5),
# initial: 72958288
# 2016-01-17: 76848856 (x86-64, Linux. drift?)
# 2017-02-01: 80882208 (Use superclass instances when solving)
# 2017-02-05: 74374440 (Probably OccAnal fixes)
# 2017-02-17: 86525344 (Type-indexed Typeable)
# 2017-02-25: 83032768 (Early inline patch)
+ # 2017-09-07: 81696664 (Semigroup=>Monoid patch, D3927)
]),
],
compile,
diff --git a/testsuite/tests/perf/should_run/T4978.hs b/testsuite/tests/perf/should_run/T4978.hs
index b661edc483..9324b72be0 100644
--- a/testsuite/tests/perf/should_run/T4978.hs
+++ b/testsuite/tests/perf/should_run/T4978.hs
@@ -4,6 +4,7 @@ import qualified Data.ByteString as S
import qualified Data.ByteString.Lazy as L
import Data.ByteString.Internal (inlinePerformIO)
import qualified Data.ByteString.Internal as S
+import Data.Semigroup
import Data.Monoid
import Foreign
import System.IO.Unsafe
@@ -12,11 +13,13 @@ newtype Builder = Builder {
runBuilder :: (Buffer -> [S.ByteString]) -> Buffer -> [S.ByteString]
}
+instance Semigroup Builder where
+ (<>) = append
+ {-# INLINE (<>) #-}
+
instance Monoid Builder where
mempty = empty
{-# INLINE mempty #-}
- mappend = append
- {-# INLINE mappend #-}
mconcat = foldr mappend mempty
{-# INLINE mconcat #-}
diff --git a/testsuite/tests/polykinds/MonoidsFD.hs b/testsuite/tests/polykinds/MonoidsFD.hs
index f093d77663..67be60d60a 100644
--- a/testsuite/tests/polykinds/MonoidsFD.hs
+++ b/testsuite/tests/polykinds/MonoidsFD.hs
@@ -15,6 +15,7 @@
module Main where
import Control.Monad (Monad(..), join, ap)
import Data.Monoid (Monoid(..))
+import Data.Semigroup (Semigroup(..))
-- First we define the type class Monoidy:
@@ -81,9 +82,11 @@ test2 = print (Sum 1 <+> Sum 2 <+> Sum 4) -- Sum 7
-- rather cumbersome in actual use. So, we can give traditional Monad and
-- Monoid instances for instances of Monoidy:
+instance Monoidy (→) (,) () m ⇒ Semigroup m where
+ (<>) = curry mjoin
+
instance Monoidy (→) (,) () m ⇒ Monoid m where
mempty = munit ()
- mappend = curry mjoin
instance Applicative Wrapper where
pure = return
diff --git a/testsuite/tests/polykinds/MonoidsTF.hs b/testsuite/tests/polykinds/MonoidsTF.hs
index 9097e53af2..365c3766bc 100644
--- a/testsuite/tests/polykinds/MonoidsTF.hs
+++ b/testsuite/tests/polykinds/MonoidsTF.hs
@@ -14,6 +14,7 @@
module Main where
import Control.Monad (Monad(..), join, ap, liftM)
import Data.Monoid (Monoid(..))
+import Data.Semigroup (Semigroup(..))
-- First we define the type class Monoidy:
@@ -91,10 +92,13 @@ test2 = print (Sum 1 <+> Sum 2 <+> Sum 4) -- Sum 7
-- rather cumbersome in actual use. So, we can give traditional Monad and
-- Monoid instances for instances of Monoidy:
-instance (MId (→) m ~ (), MComp (→) m ~ (,), Monoidy (→) m)
+instance (MId (→) m ~ (), MComp (→) m ~ (,), Monoidy (→) m)
+ ⇒ Semigroup m where
+ (<>) = curry mjoin
+
+instance (MId (→) m ~ (), MComp (→) m ~ (,), Monoidy (→) m)
⇒ Monoid m where
mempty = munit ()
- mappend = curry mjoin
instance Applicative Wrapper where
pure = return
diff --git a/testsuite/tests/polykinds/T7332.hs b/testsuite/tests/polykinds/T7332.hs
index 0d3e7e5a13..75a6cbc991 100644
--- a/testsuite/tests/polykinds/T7332.hs
+++ b/testsuite/tests/polykinds/T7332.hs
@@ -9,9 +9,10 @@ module T7332 where
import GHC.Exts( IsString(..) )
import Data.Monoid
+import Data.Semigroup
newtype DC d = DC d
- deriving (Show, Monoid)
+ deriving (Show, Semigroup, Monoid)
instance IsString (DC String) where
fromString = DC
diff --git a/testsuite/tests/semigroup/Makefile b/testsuite/tests/semigroup/Makefile
deleted file mode 100644
index 9a36a1c5fe..0000000000
--- a/testsuite/tests/semigroup/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/semigroup/SemigroupWarnings.hs b/testsuite/tests/semigroup/SemigroupWarnings.hs
deleted file mode 100644
index 83ae2cf180..0000000000
--- a/testsuite/tests/semigroup/SemigroupWarnings.hs
+++ /dev/null
@@ -1,34 +0,0 @@
--- Test purpose:
--- Ensure that missing semigroup warnings are issued
--- correctly if the warning flag is enabled
-
-{-# OPTIONS_GHC -fwarn-semigroup #-}
-
-module SemigroupWarnings where
-
-
-
-import Data.Semigroup
-
-
-
--- Bad instance, should complain about missing Semigroup parent
-data LacksSemigroup
-instance Monoid LacksSemigroup where
- mempty = undefined
- mappend = undefined
-
-
-
--- Correct instance, should not warn
-data HasSemigroup
-instance Semigroup HasSemigroup where
- (<>) = undefined
-instance Monoid HasSemigroup where
- mempty = undefined
- mappend = undefined
-
-
-
--- Should issue a Prelude clash warning
-(<>) = undefined
diff --git a/testsuite/tests/semigroup/SemigroupWarnings.stderr b/testsuite/tests/semigroup/SemigroupWarnings.stderr
deleted file mode 100644
index 277fea66ff..0000000000
--- a/testsuite/tests/semigroup/SemigroupWarnings.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-
-SemigroupWarnings.hs:17:10: warning: [-Wsemigroup (in -Wcompat)]
- ‘LacksSemigroup’ is an instance of Monoid but not Semigroup.
- This will become an error in a future release.
-
-SemigroupWarnings.hs:34:1: warning: [-Wsemigroup (in -Wcompat)]
- Local definition of ‘<>’ clashes with a future Prelude name.
- This will become an error in a future release.
diff --git a/testsuite/tests/semigroup/all.T b/testsuite/tests/semigroup/all.T
deleted file mode 100644
index 0b1c3b9878..0000000000
--- a/testsuite/tests/semigroup/all.T
+++ /dev/null
@@ -1 +0,0 @@
-test('SemigroupWarnings', normal, compile, [''])
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
diff --git a/testsuite/tests/typecheck/should_run/T6117.hs b/testsuite/tests/typecheck/should_run/T6117.hs
index 2fe9f29291..33e81c7b59 100644
--- a/testsuite/tests/typecheck/should_run/T6117.hs
+++ b/testsuite/tests/typecheck/should_run/T6117.hs
@@ -1,5 +1,7 @@
{-# LANGUAGE FlexibleContexts #-}
+import Prelude hiding (Semigroup(..))
+
{-
[Summary of the program] Ring is defined as a subclass of Semigroup,
inheriting multiplication. Additive is a wrapper that extracts the additive
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