summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T10306.hs
diff options
context:
space:
mode:
authorAdam Gundry <adam@well-typed.com>2015-05-04 15:30:37 +0100
committerAdam Gundry <adam@well-typed.com>2015-05-04 15:37:56 +0100
commit4efa421327cf127ebefde59b2eece693e37dc3c6 (patch)
treead98439468450a0d9b39c80d1a8e443e34b0445e /testsuite/tests/th/T10306.hs
parent2f6a0ac7061c59ed68a6dd5a2243e3e690acbd5f (diff)
downloadhaskell-4efa421327cf127ebefde59b2eece693e37dc3c6.tar.gz
Permit empty closed type families
Fixes #9840 and #10306, and includes an alternative resolution to #8028. This permits empty closed type families, and documents them in the user guide. It updates the Haddock submodule to support the API change. Test Plan: Added `indexed-types/should_compile/T9840` and updated `indexed-types/should_fail/ClosedFam4` and `th/T8028`. Reviewers: austin, simonpj, goldfire Reviewed By: goldfire Subscribers: bgamari, jstolarek, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D841 GHC Trac Issues: #9840, #10306
Diffstat (limited to 'testsuite/tests/th/T10306.hs')
-rw-r--r--testsuite/tests/th/T10306.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/th/T10306.hs b/testsuite/tests/th/T10306.hs
new file mode 100644
index 0000000000..b93114b61c
--- /dev/null
+++ b/testsuite/tests/th/T10306.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE TemplateHaskell, TypeFamilies #-}
+
+module T10306 where
+
+import Language.Haskell.TH
+import GHC.TypeLits
+
+-- Attempting to reify a built-in type family like (+) previously
+-- caused a crash, because it has no equations
+$(do x <- reify ''(+)
+ case x of
+ FamilyI (ClosedTypeFamilyD _ _ _ []) _ -> return []
+ _ -> error $ show x
+ )