summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/gadt/gadt4.hs
diff options
context:
space:
mode:
authorsimonpj <unknown>2004-09-09 16:30:23 +0000
committersimonpj <unknown>2004-09-09 16:30:23 +0000
commitbca164956e8e86e28fe2b3e36fbb9ce8a5d1a61d (patch)
treed8882b852ddb129ece8d26de1b3f44e756627ae8 /testsuite/tests/ghc-regress/gadt/gadt4.hs
parentd268747ee1f72de39c83c636240b761b2d2ab769 (diff)
downloadhaskell-bca164956e8e86e28fe2b3e36fbb9ce8a5d1a61d.tar.gz
[project @ 2004-09-09 16:30:22 by simonpj]
Add GADT tests; these will fail in the HEAD, but never mind
Diffstat (limited to 'testsuite/tests/ghc-regress/gadt/gadt4.hs')
-rw-r--r--testsuite/tests/ghc-regress/gadt/gadt4.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-regress/gadt/gadt4.hs b/testsuite/tests/ghc-regress/gadt/gadt4.hs
new file mode 100644
index 0000000000..7a6bc06ac1
--- /dev/null
+++ b/testsuite/tests/ghc-regress/gadt/gadt4.hs
@@ -0,0 +1,18 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+module Main where
+
+data Term a where
+ Lit :: Int -> Term Int
+ IsZero :: Term Int -> Term Bool
+ If :: Term Bool -> Term a -> Term a -> Term a
+
+
+eval :: Term a -> a
+eval (Lit n) = n
+eval (IsZero t) = eval t == 0
+eval (If t1 t2 t3) = if eval t1 then eval t2 else eval t3
+
+term = If (IsZero (Lit 1)) (Lit 2) (Lit 3)
+
+main = print (eval term) \ No newline at end of file