summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds/T12718.hs
blob: 8018e097fa48f04202338f596df1aec3a04d85fa (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 RebindableSyntax, NoImplicitPrelude, MagicHash, RankNTypes,
             PolyKinds, ViewPatterns, FlexibleInstances #-}

module Main where

import Prelude hiding (Eq (..), Num(..))
import qualified Prelude as P
import GHC.Exts
import GHC.Types

class XNum (a :: TYPE rep) where
  (+) :: a -> a -> a
  fromInteger :: Integer -> a

instance P.Num a => XNum a where
  (+) = (P.+)
  fromInteger = P.fromInteger

instance XNum Int# where
  (+) = (+#)
  fromInteger i = case fromInteger i of
                   I# n -> n

u :: Bool
u = isTrue# v_
  where
    v_ :: forall rep (a :: TYPE rep). XNum a => a
    v_ = fromInteger 10

main = print u