[project @ 2001-08-21 14:44:42 by simonmar]
[ghc-hetmet.git] / ghc / tests / etc / testexpr.hs
1 -- literal
2 -----
3
4 x = 'a' -- 1
5
6 -----
7
8 x = "123"       -- 2
9
10 -----
11
12 x = 1   -- 3
13
14 -----
15
16 x = 1.2
17
18 -----
19
20 -- exprs
21
22 -----
23
24 x = x   -- 5
25
26 -----
27
28 x = True        -- 6
29
30 -----
31
32 x = ()  -- 7
33
34 -----
35
36 (x:y) = [1,2]   -- 8
37
38 -----
39
40 (x:y) = [1,'a'] -- 9
41
42 -----
43
44 (x,y) = (1,'a') -- 10
45
46 -----
47
48 (x,y) = (1,2,3) -- 11
49
50 -----
51
52 (x:y) = (1,'a') -- 12
53
54 -----
55
56 x = 1+x -- 13
57
58 -----
59
60 x = 1+2 -- 14
61
62 -----
63
64 f x = y where y = 2     -- 15
65
66 -----
67
68
69 f x = y+2 where y = x+3
70
71 -----
72
73 f x = a where a = x:a
74
75 -----
76
77 (x:y) = case (if True then True else False) of  -- 18
78          True -> (True,1)
79          False -> (1,True)
80
81 -----
82
83 f x = \ (y,z) -> x      -- 19
84          
85 -----
86
87 (x:y) = [y+1 | (y,z) <- [(1,2)]]        -- 20
88
89 -----
90
91 x = if True then 1 else 2
92
93 -----
94
95 (z@(q,w)) = if True then (1,2) else (1,3)
96
97 -----
98
99 x = [1..2]
100
101 -----
102
103