summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/data2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/gadt/data2.hs')
-rw-r--r--testsuite/tests/gadt/data2.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/data2.hs b/testsuite/tests/gadt/data2.hs
new file mode 100644
index 0000000000..5b8a009d05
--- /dev/null
+++ b/testsuite/tests/gadt/data2.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE GADTs, ExistentialQuantification #-}
+
+-- Trac #289
+
+module ShouldCompile where
+
+class Foo a where
+ foo :: a -> Int
+
+data T = forall a. T (G a)
+data G a where
+ A :: G a
+ B :: Foo a => a -> G a
+
+doFoo :: T -> Int
+doFoo (T A) = 2
+doFoo (T (B x)) = foo x
+
+