Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / simplCore / should_run / simplrun011.hs
1 module Main where
2
3 import GHC.Exts
4
5 -- This checks that rules look through unfoldings when matching
6 -- lambdas, but only in the right phase
7
8 foo :: (Int -> IO ()) -> IO ()
9 foo f = putStr "not fired: " >> f 0
10 {-# NOINLINE foo #-}
11
12 f1 :: Int -> IO ()
13 f1 _ = putStrLn "f1"
14 {-# NOINLINE[0] f1 #-}
15
16 f2 :: Int -> IO ()
17 f2 _ = putStrLn "f2"
18 {-# NOINLINE f2 #-}
19
20 newtype Age = MkAge Int
21
22 -- It also checks that this can look through casted lambdas
23
24 f3 :: Age -> IO ()
25 f3 _ = putStrLn "f3"
26 {-# NOINLINE[0] f3 #-}
27
28
29 {-# RULES "foo" [0] forall g . foo (\x -> g) = putStr "fired: " >> g #-}
30
31 main = do
32 foo f1
33 foo f1
34 foo f2
35 foo f2
36 foo (coerce f3)
37 foo (coerce f3)