Commit 33a75d9f authored by Simon Peyton Jones's avatar Simon Peyton Jones

Test Trac #7064

parent 12512e12
{-# LANGUAGE TemplateHaskell #-}
module Main where
import T7064a
$(decls)
main = hsToTh
f1_0 x_1 = 1
f2_0 x_1 = 2
f3_0 x_1 = 3
{-# INLINE f1_0 #-}
{-# INLINE [2] f2_0 #-}
{-# INLINE CONLIKE [~2] f3_0 #-}
g1_0 x_1 = 1
g2_0 x_1 = 2
g3_0 x_1 = 3
{-# SPECIALISE g1_0 :: GHC.Types.Int -> GHC.Types.Int #-}
{-# SPECIALISE [2] g2_0 :: GHC.Types.Int -> GHC.Types.Int #-}
{-# SPECIALISE INLINE [~2] g3_0 ::
GHC.Types.Int -> GHC.Types.Int #-}
data T_0 a_1 = T_2 a_1
instance GHC.Classes.Eq a_0 => GHC.Classes.Eq (T_1 a_0)
where GHC.Classes.== (T_2 x_3) (T_2 y_4) = x_3 GHC.Classes.== y_4
{-# SPECIALISE instance GHC.Classes.Eq (T_1 GHC.Types.Int) #-}
{-# RULES "rule1"
GHC.Real.fromIntegral
= GHC.Base.id :: forall a_0 . a_0 -> a_0 #-}
{-# RULES "rule2" [1]
forall (x_1627391611 :: a_1627391612) . GHC.Real.fromIntegral x_1627391611
= x_1627391611 #-}
{-# RULES "rule3" [~1]
forall (x_1627391609 :: a_1627391610) . GHC.Real.fromIntegral x_1627391609
= x_1627391609 #-}
{-# LANGUAGE TemplateHaskell #-}
module T7064a (decls, hsToTh) where
import Language.Haskell.TH
decls = [d|
f1 x = 1; f2 x = 2; f3 x = 3
{-# INLINE f1 #-}
{-# INLINE [2] f2 #-}
{-# INLINE CONLIKE [~2] f3 #-}
g1 x = 1; g2 x = 2; g3 x = 3
{-# SPECIALISE g1 :: Int -> Int #-}
{-# SPECIALISE [2] g2 :: Int -> Int #-}
{-# SPECIALISE INLINE [~2] g3 :: Int -> Int #-}
data T a = T a
instance Eq a => Eq (T a) where
{-# SPECIALISE instance Eq (T Int) #-}
(T x) == (T y) = x == y
{-# RULES
"rule1" fromIntegral = id :: a -> a ;
"rule2" [1] forall (x :: a) . fromIntegral x = x ;
"rule3" [~1] forall (x :: a) . fromIntegral x = x
#-}
|]
hsToTh = do
decls' <- runQ decls
mapM (print . ppr) decls'
......@@ -246,3 +246,7 @@ test('T6005a', normal, compile, ['-v0'])
test('T5737', normal, compile, ['-v0'])
test('T6114', normal, compile_fail, ['-v0 -dsuppress-uniques'])
test('TH_StringPrimL', normal, compile_and_run, [''])
test('T7064',
extra_clean(['T7064a.hi', 'T7064a.o']),
multimod_compile_and_run,
['T7064.hs', '-v0'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment