newtype fixes, coercions for non-recursive newtypes now optional
[ghc-hetmet.git] / compiler / basicTypes / Id.lhs
index c7ce818..e14e47a 100644 (file)
@@ -66,7 +66,7 @@ module Id (
        idNewStrictness, idNewStrictness_maybe, 
        idWorkerInfo,
        idUnfolding,
-       idSpecialisation, idCoreRules,
+       idSpecialisation, idCoreRules, idHasRules,
        idCafInfo,
        idLBVarInfo,
        idOccInfo,
@@ -409,6 +409,9 @@ idSpecialisation id = specInfo (idInfo id)
 idCoreRules :: Id -> [CoreRule]
 idCoreRules id = specInfoRules (idSpecialisation id)
 
+idHasRules :: Id -> Bool
+idHasRules id = not (isEmptySpecInfo (idSpecialisation id))
+
 setIdSpecialisation :: Id -> SpecInfo -> Id
 setIdSpecialisation id spec_info = modifyIdInfo (`setSpecInfo` spec_info) id
 
@@ -472,7 +475,7 @@ idLBVarInfo id = lbvarInfo (idInfo id)
 isOneShotBndr :: Id -> Bool
 -- This one is the "business end", called externally.
 -- Its main purpose is to encapsulate the Horrible State Hack
-isOneShotBndr id = isOneShotLambda id || (isStateHackType (idType id))
+isOneShotBndr id = isOneShotLambda id || isStateHackType (idType id)
 
 isStateHackType :: Type -> Bool
 isStateHackType ty
@@ -522,8 +525,8 @@ clearOneShotLambda id
 
 \begin{code}
 zapLamIdInfo :: Id -> Id
-zapLamIdInfo id = maybeModifyIdInfo zapLamInfo id
+zapLamIdInfo id = maybeModifyIdInfo (zapLamInfo (idInfo id)) id
 
-zapDemandIdInfo id = maybeModifyIdInfo zapDemandInfo id
+zapDemandIdInfo id = maybeModifyIdInfo (zapDemandInfo (idInfo id)) id
 \end{code}