summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_tf2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/th/TH_tf2.hs')
-rw-r--r--testsuite/tests/th/TH_tf2.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_tf2.hs b/testsuite/tests/th/TH_tf2.hs
new file mode 100644
index 0000000000..94be291324
--- /dev/null
+++ b/testsuite/tests/th/TH_tf2.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module TH_tf2 where
+
+{-
+$( [d| class C a where
+ data T a
+ foo :: Bool -> T a |] )
+
+$( [d| instance C Int where
+ data T Int = TInt Bool
+ foo b = TInt (b && b) |] )
+
+$( [d| instance C Float where
+ data T Float = TFloat {flag :: Bool}
+ foo b = TFloat {flag = b && b} |] )
+-}
+
+class D a where
+ type S a
+ bar :: S a -> Int
+
+instance D Int where
+ type S Int = Bool
+ bar c = if c then 1 else 2