[project @ 1999-07-30 11:26:09 by simonmar]
[ghc-hetmet.git] / ghc / compiler / types / Type.lhs
index bd502b5..ccd8af7 100644 (file)
@@ -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
@@ -865,7 +872,7 @@ isNewType ty = case splitTyConApp_maybe ty of
                        other              -> False
 
 typePrimRep :: Type -> PrimRep
-typePrimRep ty = case splitTyConApp_maybe ty of
+typePrimRep ty = case splitTyConApp_maybe (repType ty) of
                   Just (tc, ty_args) -> tyConPrimRep tc
                   other              -> PtrRep
 \end{code}