summaryrefslogtreecommitdiff
path: root/ghc/compiler/tests/validation-misc/testexpr.hs
blob: bcaef3f6dff0a699d28afe2b247cc9a3695d0da9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
-- literal
-----

x = 'a'	-- 1

-----

x = "123"	-- 2

-----

x = 1	-- 3

-----

x = 1.2

-----

-- exprs

-----

x = x	-- 5

-----

x = True	-- 6

-----

x = ()	-- 7

-----

(x:y) = [1,2]	-- 8

-----

(x:y) = [1,'a']	-- 9

-----

(x,y) = (1,'a')	-- 10

-----

(x,y) = (1,2,3)	-- 11

-----

(x:y) = (1,'a') -- 12

-----

x = 1+x	-- 13

-----

x = 1+2	-- 14

-----

f x = y where y = 2	-- 15

-----


f x = y+2 where y = x+3

-----

f x = a where a = x:a

-----

(x:y) = case (if True then True else False) of	-- 18
         True -> (True,1)
         False -> (1,True)

-----

f x = \ (y,z) -> x	-- 19
         
-----

(x:y) = [y+1 | (y,z) <- [(1,2)]]	-- 20

-----

x = if True then 1 else 2

-----

(z@(q,w)) = if True then (1,2) else (1,3)

-----

x = [1..2]

-----