summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_run/T4235.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/indexed-types/should_run/T4235.hs')
-rw-r--r--testsuite/tests/indexed-types/should_run/T4235.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_run/T4235.hs b/testsuite/tests/indexed-types/should_run/T4235.hs
new file mode 100644
index 0000000000..45ba33df20
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_run/T4235.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE TypeFamilies, StandaloneDeriving, FlexibleInstances, GADTs #-}
+module Main where
+
+import Data.Ix
+
+-- Deriving Enum with phantom type parameter
+data T a = R | S | T deriving( Enum, Show )
+
+-- Tests that deriving works for data families
+data family Foo a
+
+data instance Foo Int
+ = A | B | C | D
+ deriving (Eq, Enum)
+
+f :: Foo Int -> Bool
+f A = True
+f B = False
+f _ = True
+
+-- Tests that deriving works for GADTs
+data Bar a where
+ P :: Int -> Bar Int
+ Q :: Bar Int
+
+deriving instance (Eq (Bar Int))
+
+main = do { print [R .. T]
+ ; print (map f [B .. D])
+ ; print [P 3 == P 3, P 4 == Q] }