summaryrefslogtreecommitdiff
path: root/testsuite/tests/rep-poly/T12709.hs
blob: 6a7e37a5d256bf4e7c0ae86efcf2c739cd0eac3c (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
30
{-# Language PolyKinds, ViewPatterns, RebindableSyntax,
             MagicHash, NoImplicitPrelude #-}

module T12709 where

import GHC.Types
import Prelude hiding (Num (..))
import qualified Prelude as P
import GHC.Prim

data BoxUnbox = BUB Int Int#

class Num (a :: TYPE rep) where
  (+) :: a -> a -> a

  fromInteger :: Integer -> a

instance Num Int where
  (+) = (P.+)
  fromInteger = P.fromInteger

instance Num Int# where
  (+) = (+#)
  fromInteger (fromInteger -> I# n) = n

a :: BoxUnbox
a = let u :: Num (a :: TYPE rep) => a
        u = 1 + 2 + 3 + 4
     in
        BUB u u