diff options
Diffstat (limited to 'compiler/types/Type.hs')
-rw-r--r-- | compiler/types/Type.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index a2d339210c..9cec0bd338 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -66,7 +66,7 @@ module Type ( -- (Lifting and boxity) isUnLiftedType, isUnboxedTupleType, isAlgType, isClosedAlgType, - isPrimitiveType, isStrictType, + isPrimitiveType, isStrictType, isEmptyTy, -- * Main data types representing Kinds -- $kind_subtyping @@ -1184,6 +1184,16 @@ isPrimitiveType ty = case splitTyConApp_maybe ty of isPrimTyCon tc _ -> False +-- | True if the type has no non-bottom elements +isEmptyTy :: Type -> Bool +isEmptyTy ty + -- Data types with no constructors are empty + | Just (tc, _) <- splitTyConApp_maybe ty + , isEmptyDataTyCon tc + = True + | otherwise + = False + {- ************************************************************************ * * |