summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/tcfail042.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/tcfail042.hs')
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail042.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/tcfail042.hs b/testsuite/tests/typecheck/should_fail/tcfail042.hs
new file mode 100644
index 0000000000..5fdf6c61b6
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail042.hs
@@ -0,0 +1,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
+-}