Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / parser / should_fail / readFail001.hs
1 -- !!! this module supposedly includes one of each Haskell construct
2
3 -- HsImpExp stuff
4
5 module OneOfEverything (
6 fixn,
7 FooData,
8 FooDataB(..),
9 FooDataC( .. ),
10 Tree(Leaf, Branch),
11 EqClass(..),
12 OrdClass(orda, ordb),
13 module OneC ,
14 module OneOfEverything
15 ) where
16
17 import Prelude
18 import System.IO ( putStr )
19 import System.Environment hiding ( getArgs )
20 import Control.Monad
21
22 -- HsDecls stuff
23
24 infix 6 `fixn`
25 infixl 7 +#
26 infixr 8 `fixr`
27
28 fixn x y = x
29 fixl x y = x
30 fixr x y = x
31
32 type Pair a b = (a, b)
33
34 data FooData = FooCon Int
35
36 data FooDataB = FooConB Double
37
38 data Tree a = Leaf a | Branch (Leaf a) (Leaf a)
39
40 class (Eq a) => EqClass a where
41 eqc :: a -> Char
42 eqc x = '?'
43
44 class (Ord a) => OrdClass a where
45 orda :: a -> Char
46 ordb :: a -> Char
47 ordc :: a -> Char
48
49 instance (Eq a) => EqClass (Tree a) where
50 eqc x = 'a'
51
52 default (Integer, Rational)
53
54 -- HsBinds stuff
55
56 singlebind x = x
57
58 bindwith :: (OrdClass a, OrdClass b) => a -> b -> b
59 bindwith a b = b
60
61 reca a = recb a
62 recb a = reca a
63
64 (~(a,b,c)) | nullity b = a
65 | nullity c = a
66 | otherwise = a
67 where
68 nullity = null
69
70 -- HsMatches stuff
71
72 mat a b c d | foof a b = d
73 | foof a c = d
74 | foof b c = d
75 where
76 foof a b = a == b
77
78 -- HsExpr stuff
79 expr a b c d
80 = a
81 + (:) a b
82 + (a : b)
83 + (1 - 'c' - "abc" - 1.293)
84 + ( \ x y z -> x ) 42
85 + (9 *)
86 + (* 8)
87 + (case x of
88 [] | null x -> 99
89 | otherwise -> 98
90 | True -> 97
91 where
92 null x = False
93 )
94 + [ z | z <- c, isSpace z ]
95 + let y = foo
96 in y
97 + [1,2,3,4]
98 + (4,3,2,1)
99 + (4 :: Num a => a)
100 + (if 42 == 42.0 then 1 else 4)
101 + [1..]
102 + [2,4..]
103 + [3..5]
104 + [4,8..999]
105
106 -- HsPat stuff
107 f _ x 1 1.93 'c' "dog" ~y z@(Foo a b) (c `Bar` d) [1,2] (3,4) = y
108
109 -- HsLit stuff -- done above
110
111 -- HsTypes stuff
112 g :: (Num a, Eq b) => Foo a -> [b] -> (a,a,a) -> b
113 g x y z = head y