aaa6a4a8ac1a0740c1aef454a2382001e8d5943e
[ghc-hetmet.git] / ghc / tests / simplCore / should_run / simplrun002.hs
1 {-# OPTIONS -fglasgow-exts #-}
2
3 -- !!! A rules test
4 -- At one time the rule got too specialised a type:
5 --
6 --  _R "ffoo" forall {@ a1 v :: (a1, ((), ()))} 
7 --            fst @ a1 @ () (sndSnd @ a1 @ () @ () v) = fst @ a1 @ ((), ()) v
8
9
10 module Main where
11
12 import IO
13 import PrelIOBase( unsafePerformIO )
14
15 sndSnd (a,(b,c)) = (a,c)
16
17 trace x y = unsafePerformIO (hPutStr stderr x >> hPutStr stderr "\n" >> return y)
18
19 {-# RULES "foo" forall v .  fst (sndSnd v) = trace "Yes" (fst v) #-}
20
21 main :: IO ()
22 main = print (fst (sndSnd (True, (False,True))))