summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T20820.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T20820.hs')
-rw-r--r--testsuite/tests/simplCore/should_compile/T20820.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T20820.hs b/testsuite/tests/simplCore/should_compile/T20820.hs
new file mode 100644
index 0000000000..546f61e919
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T20820.hs
@@ -0,0 +1,29 @@
+module T20820 ( ) where
+
+import Prelude hiding (concat)
+import Data.Semigroup (Semigroup (sconcat, stimes))
+import Data.List.NonEmpty (NonEmpty ((:|)))
+
+data ByteString = BS
+
+instance Semigroup ByteString where
+ (<>) = undefined
+ sconcat (b:|bs) = concat (b:bs)
+ stimes = stimesPolymorphic
+instance Monoid ByteString where
+ mempty = undefined
+
+concat :: [ByteString] -> ByteString
+concat = undefined
+{-# NOINLINE concat #-}
+
+{-# RULES
+"ByteString concat [] -> mempty"
+ concat [] = mempty
+ #-}
+
+stimesPolymorphic :: Integral a => a -> ByteString -> ByteString
+stimesPolymorphic nRaw bs = stimesInt (fromIntegral nRaw) bs
+
+stimesInt :: Int -> ByteString -> ByteString
+stimesInt _ BS = mempty