eff0f1b18f92aaad2c4044b82b327702d2a1506b
[ghc.git] / testsuite / tests / th / TH_Lift.hs
1 -- test Lifting instances
2
3 {-# LANGUAGE TemplateHaskell #-}
4
5 module TH_Lift where
6
7 import Language.Haskell.TH.Syntax
8 import Data.Ratio
9 import Data.Word
10 import Data.Int
11 import Numeric.Natural
12
13 a :: Integer
14 a = $( (\x -> [| x |]) (5 :: Integer) )
15
16 b :: Int
17 b = $( (\x -> [| x |]) (5 :: Int) )
18
19 b1 :: Int8
20 b1 = $( (\x -> [| x |]) (5 :: Int8) )
21
22 b2 :: Int16
23 b2 = $( (\x -> [| x |]) (5 :: Int16) )
24
25 b3 :: Int32
26 b3 = $( (\x -> [| x |]) (5 :: Int32) )
27
28 b4 :: Int64
29 b4 = $( (\x -> [| x |]) (5 :: Int64) )
30
31 c :: Word
32 c = $( (\x -> [| x |]) (5 :: Word) )
33
34 d :: Word8
35 d = $( (\x -> [| x |]) (5 :: Word8) )
36
37 e :: Word16
38 e = $( (\x -> [| x |]) (5 :: Word16) )
39
40 f :: Word32
41 f = $( (\x -> [| x |]) (5 :: Word32) )
42
43 g :: Word64
44 g = $( (\x -> [| x |]) (5 :: Word64) )
45
46 g1 :: Natural
47 g1 = $( (\x -> [| x |]) (5 :: Natural) )
48
49 h :: Rational
50 h = $( (\x -> [| x |]) (5 % 3 :: Rational) )
51
52 h1 :: Float
53 h1 = $( (\x -> [| x |]) (pi :: Float) )
54
55 h2 :: Double
56 h2 = $( (\x -> [| x |]) (pi :: Double) )
57
58 i :: Char
59 i = $( (\x -> [| x |]) 'x' )
60
61 j :: Bool
62 j = $( (\x -> [| x |]) True )
63
64 k :: Maybe Char
65 k = $( (\x -> [| x |]) (Just 'x') )
66
67 l :: Either Char Bool
68 l = $( (\x -> [| x |]) (Right False :: Either Char Bool) )
69
70 m :: [Char]
71 m = $( (\x -> [| x |]) "hi!")
72
73 n :: ()
74 n = $( (\x -> [| x |]) () )
75
76 o :: (Bool, Char, Int)
77 o = $( (\x -> [| x |]) (True, 'x', 4 :: Int) )
78
79