238a2c3410dd9c784b6d6bb96daec41f56614be9
[ghc-hetmet.git] / ghc / tests / deSugar / should_run / ds005.hs
1 {- 
2
3 From: Olaf Chitil <chitil@Informatik.RWTH-Aachen.DE>
4
5 It is a problem with 0.29 (which we use for compiling 2.01), it is gone
6 in 2.01.
7
8         f :: Eq a => a -> [b] -> [b] -> Bool
9         f a [] [] = (a==a)
10         main = print (f True "" "Hallo")
11
12
13 when run after compilation with 0.29 you get:
14 Fail: "test.hs", line 6: incomplete pattern(s) to match in function "ds.d5b4"
15
16 while 2.01 gives you as desired
17 Fail: In pattern-matching: function f{-aYw-}; at test.hs, line 6
18
19 The problem is the dictionary, because for the program
20
21         f :: a -> [b] -> [b] -> Bool
22         f a [] [] = True
23         main = print (f True "" "Hallo")
24
25 0.29 gives the function name "f" as well.
26
27 So it's ok in 2.01, but why did you change the form of the error messages?
28 "incomplete pattern(s) to match" is more informative then "In pattern-matching"!
29 I even prefer the order of information in the 0.29 error messages.
30
31 May I finally repeat that in my opinion the compiler should warn about
32 incomplete patterns during compilation. However, I suppose the
33 incomplete patterns are just recognised by the desugarer which does
34 not produce error messages any more.
35
36 -}
37
38
39 module Main where
40
41 f :: Eq a => a -> [b] -> [b] -> Bool
42 f a [] [] = (a==a)
43
44 main = print (f True "" "Hallo")
45
46