[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / tests / deSugar / ds036.hs
1 {-
2 From dmc@minster.york.ac.uk Tue Mar 10 17:15:20 1992
3 Via: uk.ac.york.minster; Tue, 10 Mar 92 17:15:14 GMT
4 Message-Id: <swordfish.700247842@minster.york.ac.uk>
5 From: dmc@minster.york.ac.uk
6 To: partain
7 Date:       10 Mar 1992 17:17:21 GMT
8
9 Will,
10
11 I have just started using Haskell at York and have found a compilation 
12 error in the code below which disappears when the last line is 
13 commented out
14 -}
15
16 module Test2 where
17
18 --brack :: (Eq a) => a -> a -> [a] -> ([a],[a])
19 --brack open close = brack' open close (1 :: Int)
20
21 brack' :: (Eq a) => a -> a -> Int -> [a] -> ([a],[a])
22 brack' open close 0 xs = ([],xs)
23 brack' open close (n+1) [] = ([],[])
24 brack' open close (n+1) (h:t) | h == open = ([],[])
25
26 {-
27 Is this something I have done wrong or a fault with the compiler?
28
29 Cheers
30 Dave
31
32
33 -----------------------------------------------------------------------
34 David Cattrall                  Telephone +44 904 432777
35 Department of Computer Science  
36 University of York              JANET:  dmc@uk.ac.york.minster
37 YORK Y01 5DD
38 United Kingdom                  UUNET:  uucp!ukc!minster!dmc
39 -----------------------------------------------------------------------
40 -}
41
42 -- and this was Kevin's idea, subsequently...
43
44 kh (n+2) x | x > n = x * 2
45 kh (x+1) (m+1) = m