summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_tf1.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/th/TH_tf1.hs')
-rw-r--r--testsuite/tests/th/TH_tf1.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_tf1.hs b/testsuite/tests/th/TH_tf1.hs
new file mode 100644
index 0000000000..2b5d3f8887
--- /dev/null
+++ b/testsuite/tests/th/TH_tf1.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module TH_tf1 where
+
+$( [d| data family T a |] )
+$( [d| data instance T Int = TInt Bool |] )
+
+foo :: Bool -> T Int
+foo b = TInt (b && b)
+
+$( [d| type family S a |] )
+$( [d| type instance S Int = Bool |] )
+
+bar :: S Int -> Int
+bar c = if c then 1 else 2
+
+$( [d| type family R (a :: * -> *) :: * -> * |] )
+$( [d| type instance R Maybe = [] |] )
+
+baz :: R Maybe Int -> Int
+baz = head