summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/gadt18.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/gadt/gadt18.hs')
-rw-r--r--testsuite/tests/gadt/gadt18.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/gadt18.hs b/testsuite/tests/gadt/gadt18.hs
new file mode 100644
index 0000000000..4ac12efa84
--- /dev/null
+++ b/testsuite/tests/gadt/gadt18.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE GADTs #-}
+-- A simple GADT test from Roman
+-- which nevertheless showed up a bug at one stage
+
+module ShouldCompile where
+
+data T a where
+ T1 :: () -> T ()
+ T2 :: T a -> T b -> T (a,b)
+
+class C a where
+ f :: T a -> a
+
+instance C () where
+ f (T1 x) = x
+
+instance (C a, C b) => C (a,b) where
+ f (T2 x y) = (f x, f y)