summaryrefslogtreecommitdiff
path: root/compiler/types/TyCon.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/types/TyCon.hs')
-rw-r--r--compiler/types/TyCon.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index 8e0175a6cf..c3723c4661 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -42,6 +42,7 @@ module TyCon(
promotableTyCon_maybe, promoteTyCon,
isDataTyCon, isProductTyCon, isDataProductTyCon_maybe,
+ isEmptyDataTyCon,
isEnumerationTyCon,
isNewTyCon, isAbstractTyCon,
isFamilyTyCon, isOpenFamilyTyCon,
@@ -1286,6 +1287,15 @@ isDataProductTyCon_maybe (TupleTyCon { dataCon = con })
= Just con
isDataProductTyCon_maybe _ = Nothing
+-- | True of datatypes with no constructors
+isEmptyDataTyCon :: TyCon -> Bool
+isEmptyDataTyCon tc
+ | AlgTyCon {algTcRhs = rhs} <- tc
+ , [] <- data_cons rhs
+ = True
+ | otherwise
+ = False
+
-- | Is this a 'TyCon' representing a regular H98 type synonym (@type@)?
isTypeSynonymTyCon :: TyCon -> Bool
isTypeSynonymTyCon (SynonymTyCon {}) = True