summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T20820.hs
blob: 546f61e9192b883b3f087f32b1c802afd4d74fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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