T12718.hs 664 Bytes
Newer Older
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, TypeInType, FlexibleInstances #-}

module Main where

import Prelude hiding (Eq (..), Num(..))
import qualified Prelude as P
import GHC.Prim
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