summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_compile/ds036.hs
blob: 12b90ed3abc79ff06c23e0016d0c65dcb7d26e25 (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
{-
From dmc@minster.york.ac.uk Tue Mar 10 17:15:20 1992
Via: uk.ac.york.minster; Tue, 10 Mar 92 17:15:14 GMT
Message-Id: <swordfish.700247842@minster.york.ac.uk>
From: dmc@minster.york.ac.uk
To: partain
Date:       10 Mar 1992 17:17:21 GMT

Will,

I have just started using Haskell at York and have found a compilation 
error in the code below which disappears when the last line is 
commented out
-}

{-# LANGUAGE NPlusKPatterns #-}

module ShouldCompile where

--brack :: (Eq a) => a -> a -> [a] -> ([a],[a])
--brack open close = brack' open close (1 :: Int)

brack' :: (Eq a) => a -> a -> Int -> [a] -> ([a],[a])
brack' open close 0 xs = ([],xs)
brack' open close (n+1) [] = ([],[])
brack' open close (n+1) (h:t) | h == open = ([],[])

{-
Is this something I have done wrong or a fault with the compiler?

Cheers
Dave


-----------------------------------------------------------------------
David Cattrall			Telephone +44 904 432777
Department of Computer Science	
University of York		JANET:	dmc@uk.ac.york.minster
YORK Y01 5DD
United Kingdom			UUNET:	uucp!ukc!minster!dmc
-----------------------------------------------------------------------
-}

-- and this was Kevin's idea, subsequently...

kh (n+2) x | x > n = x * 2
kh (x+1) (m+1) = m