exceptions: Bump submodule back to master
[ghc.git] / testsuite / tests / typecheck / should_run / UnliftedNewtypesFamilyRun.hs
1 {-# LANGUAGE GADTSyntax #-}
2 {-# LANGUAGE KindSignatures #-}
3 {-# LANGUAGE MagicHash #-}
4 {-# LANGUAGE UnliftedNewtypes #-}
5 {-# LANGUAGE RankNTypes #-}
6 {-# LANGUAGE TypeFamilies #-}
7
8 import GHC.Int (Int(I#))
9 import GHC.Word (Word(W#))
10 import GHC.Exts (Int#,Word#)
11 import GHC.Types
12
13 main :: IO ()
14 main = do
15 print (method 5 (BarIntC 6#))
16 print (method 13 (BarWordC 9#))
17
18 class Foo a where
19 data Bar a :: TYPE 'IntRep
20 method :: a -> Bar a -> a
21
22 instance Foo Int where
23 newtype Bar Int = BarIntC Int#
24 method x (BarIntC y) = x + I# y
25
26 instance Foo Word where
27 newtype Bar Word = BarWordC Int#
28 method x (BarWordC y) = x - fromIntegral (I# y)