Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / simplCore / should_run / T2110.hs
1 {-# LANGUAGE MagicHash #-}
2
3 import GHC.Exts
4 import Unsafe.Coerce
5
6 newtype Age = Age Int
7
8 foo :: [Int] -> [Int]
9 foo = map id
10 fooAge :: [Int] -> [Age]
11 fooAge = map Age
12 fooCoerce :: [Int] -> [Age]
13 fooCoerce = map coerce
14 fooUnsafeCoerce :: [Int] -> [Age]
15 fooUnsafeCoerce = map unsafeCoerce
16
17 same :: a -> b -> IO ()
18 same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of
19 1# -> putStrLn "yes"
20 _ -> putStrLn "no"
21
22 main = do
23 let l = [1,2,3]
24 same (foo l) l
25 same (fooAge l) l
26 same (fooCoerce l) l
27 same (fooUnsafeCoerce l) l