summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/tcfail042.hs
blob: 5fdf6c61b6f674eecc0d3b87538206d9d8b89a87 (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
module ShouldFail where

-- !!! weird class/instance examples off the haskell list
--

class Foo a          where foo :: a -> a
class Foo a => Bar a where bar :: a -> a


instance Num a => Foo [a] where
    foo []     = []
    foo (x:xs) = map (x+) xs


instance (Eq a, Show a) => Bar [a] where
    bar []     = []
    bar (x:xs) = foo xs where u = x==x
                              v = show x

------------------------------------------

{-
class Foo a => Bar2 a where bar2 :: a -> a

instance (Eq a, Show a) => Foo [a]

instance Num a => Bar2 [a]

data X a = X a
-}