summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_fail/drvfail002.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deriving/should_fail/drvfail002.hs')
-rw-r--r--testsuite/tests/deriving/should_fail/drvfail002.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_fail/drvfail002.hs b/testsuite/tests/deriving/should_fail/drvfail002.hs
new file mode 100644
index 0000000000..26a8f083d2
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/drvfail002.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE UndecidableInstances,
+ MultiParamTypeClasses, FunctionalDependencies #-}
+
+-- The Show instance for S would have form
+-- instance X T c => Show S
+-- which is hard to deal with. It sent GHC 5.01 into
+-- an infinite loop; now it should be rejected.
+
+module ShouldFail where
+
+data T = T Integer
+
+class X a b | a -> b where
+ f :: a -> b
+
+instance X T c => Show T where
+ show _ = ""
+
+data S = S T deriving Show
+