Commit b9328630 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

TH: test for pragma support

parent 9d720fbb
module TH_pragma where
$( [d| foo :: Int -> Int
{-# NOINLINE foo #-}
foo x = x + 1 |] )
$( [d| bar :: Num a => a -> a
{-# SPECIALISE INLINE [~1] bar :: Float -> Float #-}
bar x = x * 10 |] )
TH_pragma.hs:1:0:
TH_pragma.hs:1:0: Splicing declarations
[d| foo :: Int -> Int
{-# NOINLINE foo #-}
foo x = x + 1 |]
======>
TH_pragma.hs:(4,3)-(6,25)
foo :: GHC.Types.Int -> GHC.Types.Int
{-# NOINLINE foo #-}
foo x[] = (x[] `GHC.Num.+` 1)
TH_pragma.hs:1:0:
TH_pragma.hs:1:0: Splicing declarations
[d| bar :: (Num a) => a -> a
{-# SPECIALIZE INLINE [~1] bar :: Float -> Float #-}
bar x = x * 10 |]
======>
TH_pragma.hs:(8,3)-(10,30)
bar :: forall a[]. (GHC.Num.Num a[]) => a[] -> a[]
{-# SPECIALIZE INLINE [~1] bar ::
GHC.Types.Float -> GHC.Types.Float #-}
bar x[] = (x[] `GHC.Num.*` 10)
......@@ -137,3 +137,5 @@ test('TH_sections', normal, compile, ['-v0'])
test('TH_tf1', if_compiler_lt('ghc', '6.11', expect_fail), compile, ['-v0'])
test('TH_tf2', if_compiler_lt('ghc', '6.11', expect_fail), compile, ['-v0'])
test('TH_tf3', if_compiler_lt('ghc', '6.11', expect_fail), compile, ['-v0'])
test('TH_pragma', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques -S'])
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