From 938f825c4c3aac524459a801816db10718dff9de Mon Sep 17 00:00:00 2001
From: simonpj <unknown>
Date: Mon, 26 Jul 1999 15:37:41 +0000
Subject: [PATCH] [project @ 1999-07-26 15:37:41 by simonpj] Make
 Type.isUnLiftedType return True for forall'd unlifted types: e.g.	x ::
 forall a. Int#

I found bindings like these were getting floated to the top level.
They are pretty bogus types, mind you.  It would be better never to
construct them.

(George Russell tripped over this one.)
---
 ghc/compiler/types/Type.lhs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ghc/compiler/types/Type.lhs b/ghc/compiler/types/Type.lhs
index bd502b56fdab..8271ce32f389 100644
--- a/ghc/compiler/types/Type.lhs
+++ b/ghc/compiler/types/Type.lhs
@@ -835,9 +835,16 @@ isUnboxedType :: Type -> Bool
 isUnboxedType ty = not (isFollowableRep (typePrimRep ty))
 
 isUnLiftedType :: Type -> Bool
-isUnLiftedType ty = case splitTyConApp_maybe ty of
-			   Just (tc, ty_args) -> isUnLiftedTyCon tc
-			   other	      -> False
+	-- isUnLiftedType returns True for forall'd unlifted types:
+	--	x :: forall a. Int#
+	-- I found bindings like these were getting floated to the top level.
+	-- They are pretty bogus types, mind you.  It would be better never to
+	-- construct them
+
+isUnLiftedType (ForAllTy tv ty) = isUnLiftedType ty
+isUnLiftedType (NoteTy _ ty)	= isUnLiftedType ty
+isUnLiftedType (TyConApp tc _)  = isUnLiftedTyCon tc
+isUnLiftedType other		= False
 
 isUnboxedTupleType :: Type -> Bool
 isUnboxedTupleType ty = case splitTyConApp_maybe ty of
-- 
GitLab