summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/gadt-escape1.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/gadt/gadt-escape1.hs')
-rw-r--r--testsuite/tests/gadt/gadt-escape1.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/gadt-escape1.hs b/testsuite/tests/gadt/gadt-escape1.hs
new file mode 100644
index 0000000000..4ff33b299b
--- /dev/null
+++ b/testsuite/tests/gadt/gadt-escape1.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE GADTs, ExistentialQuantification #-}
+
+module Escape where
+
+data ExpGADT t where
+ ExpInt :: Int -> ExpGADT Int
+
+data Hidden = forall t . Hidden (ExpGADT t) (ExpGADT t)
+
+hval = Hidden (ExpInt 0) (ExpInt 1)
+
+-- With the type sig this is ok, but without it maybe
+-- should be rejected becuase the result type is wobbly
+-- weird1 :: ExpGADT Int
+
+weird1 = case (hval :: Hidden) of Hidden (ExpInt _) a -> a
+ -- Hidden t (ExpInt (co :: t ~ Int) _ :: ExpGADT t) (a :: ExpGADT t)
+
+weird2 :: ExpGADT Int
+weird2 = case (hval :: Hidden) of Hidden (ExpInt _) a -> a