Add 'Lift' instances for 'NonEmpty' and 'Void'
[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 import Data.List.NonEmpty
13
14 a :: Integer
15 a = $( (\x -> [| x |]) (5 :: Integer) )
16
17 b :: Int
18 b = $( (\x -> [| x |]) (5 :: Int) )
19
20 b1 :: Int8
21 b1 = $( (\x -> [| x |]) (5 :: Int8) )
22
23 b2 :: Int16
24 b2 = $( (\x -> [| x |]) (5 :: Int16) )
25
26 b3 :: Int32
27 b3 = $( (\x -> [| x |]) (5 :: Int32) )
28
29 b4 :: Int64
30 b4 = $( (\x -> [| x |]) (5 :: Int64) )
31
32 c :: Word
33 c = $( (\x -> [| x |]) (5 :: Word) )
34
35 d :: Word8
36 d = $( (\x -> [| x |]) (5 :: Word8) )
37
38 e :: Word16
39 e = $( (\x -> [| x |]) (5 :: Word16) )
40
41 f :: Word32
42 f = $( (\x -> [| x |]) (5 :: Word32) )
43
44 g :: Word64
45 g = $( (\x -> [| x |]) (5 :: Word64) )
46
47 g1 :: Natural
48 g1 = $( (\x -> [| x |]) (5 :: Natural) )
49
50 h :: Rational
51 h = $( (\x -> [| x |]) (5 % 3 :: Rational) )
52
53 h1 :: Float
54 h1 = $( (\x -> [| x |]) (pi :: Float) )
55
56 h2 :: Double
57 h2 = $( (\x -> [| x |]) (pi :: Double) )
58
59 i :: Char
60 i = $( (\x -> [| x |]) 'x' )
61
62 j :: Bool
63 j = $( (\x -> [| x |]) True )
64
65 k :: Maybe Char
66 k = $( (\x -> [| x |]) (Just 'x') )
67
68 l :: Either Char Bool
69 l = $( (\x -> [| x |]) (Right False :: Either Char Bool) )
70
71 m :: [Char]
72 m = $( (\x -> [| x |]) "hi!")
73
74 n :: ()
75 n = $( (\x -> [| x |]) () )
76
77 o :: (Bool, Char, Int)
78 o = $( (\x -> [| x |]) (True, 'x', 4 :: Int) )
79
80 p :: NonEmpty Char
81 p = $( (\x -> [| x |]) ('a' :| "bcde") )
82