summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/scripts/ghci047.script
diff options
context:
space:
mode:
authorDaniel Winograd-Cort <dwc@cs.yale.edu>2011-08-25 17:30:41 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-09-21 01:14:32 +0100
commit0ce6b6c11c3df08edcc5a89190f56e5a4f2922e6 (patch)
tree918afcadddc6fba31a377cafa3af9f018e9126d0 /testsuite/tests/ghci/scripts/ghci047.script
parentb4d342606fd0a1fc2300291036c52ca20de7c1ab (diff)
downloadhaskell-0ce6b6c11c3df08edcc5a89190f56e5a4f2922e6.tar.gz
Test cases for GHCi data, class, etc.
Test cases for GHCi data, type, newtype, class, instance, deriving, etc declarations.
Diffstat (limited to 'testsuite/tests/ghci/scripts/ghci047.script')
-rw-r--r--testsuite/tests/ghci/scripts/ghci047.script40
1 files changed, 40 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/ghci047.script b/testsuite/tests/ghci/scripts/ghci047.script
new file mode 100644
index 0000000000..49d93047f6
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci047.script
@@ -0,0 +1,40 @@
+--Testing GADTs, type families as well as a ton of crazy type stuff
+:set -XGADTs
+:set -XTypeFamilies
+:set -XOverlappingInstances
+:set -XFunctionalDependencies
+:set -XFlexibleContexts
+:set -XFlexibleInstances
+:set -XUndecidableInstances
+data A
+data B
+data C
+:{
+data ABorC t where
+ Foo :: Int -> ABorC A
+ Bar :: Bool -> ABorC A
+ Baz :: Char -> ABorC B
+ Quz :: ABorC B
+ Yud :: String -> ABorC C
+ Myp :: Double -> ABorC C
+:}
+data HTrue
+data HFalse
+
+class TypeEq x y b | x y -> b
+instance (HTrue ~ b) => TypeEq x x b
+instance (HFalse ~ b) => TypeEq x y b
+
+type family Or a b
+type instance Or HTrue HTrue = HTrue
+type instance Or HTrue HFalse = HTrue
+type instance Or HFalse HTrue = HTrue
+type instance Or HFalse HFalse = HFalse
+
+let f :: (Or a c ~ HTrue, TypeEq t A a, TypeEq t C c) => ABorC t -> Int ; f x = 1
+f $ Foo 1
+f $ Bar True
+f $ Baz 'a'
+f $ Quz
+f $ Yud "a"
+f $ Myp 4.3