summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/gadt2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/gadt/gadt2.hs')
-rw-r--r--testsuite/tests/gadt/gadt2.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/gadt2.hs b/testsuite/tests/gadt/gadt2.hs
new file mode 100644
index 0000000000..886b702ce7
--- /dev/null
+++ b/testsuite/tests/gadt/gadt2.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE ExplicitForAll,GADTs #-}
+
+-- Pattern match uses dictionaries bound higher up in the pattern
+
+module Main where
+
+data T = forall a. Integral a => T a
+
+f :: T -> Bool
+f (T 0) = True
+f (T n) = False
+
+g :: T -> Ordering
+g (T n) | n >= 3 = if n>3 then GT else EQ
+g (T n) = LT
+
+main = do print [f (T 0), f (T 1)]
+ print [g (T 2), g (T 3), g (T 4)]