X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2FbasicTypes%2FId.lhs;h=eff4c153cb4519ee196aae37a2d9dda3301bee26;hb=17b297d97d327620ed6bfab942f8992b2446f1bf;hp=549a58bb5d2773d7608e804cd61154566049cf04;hpb=8100cd4395e46ae747be4298c181a4730d6206bc;p=ghc-hetmet.git diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs index 549a58b..eff4c15 100644 --- a/compiler/basicTypes/Id.lhs +++ b/compiler/basicTypes/Id.lhs @@ -5,6 +5,13 @@ \section[Id]{@Ids@: Value and constructor identifiers} \begin{code} +{-# OPTIONS_GHC -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings +-- for details + module Id ( Id, DictId, @@ -25,7 +32,7 @@ module Id ( zapLamIdInfo, zapDemandIdInfo, zapFragileIdInfo, -- Predicates - isImplicitId, isDeadBinder, isDictId, + isImplicitId, isDeadBinder, isDictId, isStrictId, isExportedId, isLocalId, isGlobalId, isRecordSelector, isNaughtyRecordSelector, isClassOpId_maybe, @@ -154,7 +161,7 @@ mkSysLocal fs uniq ty = mkLocalId (mkSystemVarName uniq fs) ty -- UserLocal: an Id with a name the user might recognize... -mkUserLocal :: OccName -> Unique -> Type -> SrcLoc -> Id +mkUserLocal :: OccName -> Unique -> Type -> SrcSpan -> Id mkVanillaGlobal :: Name -> Type -> IdInfo -> Id mkUserLocal occ uniq ty loc = mkLocalId (mkInternalName uniq occ loc) ty @@ -175,7 +182,7 @@ mkWorkerId :: Unique -> Id -> Type -> Id mkWorkerId uniq unwrkr ty = mkLocalId wkr_name ty where - wkr_name = mkInternalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr) + wkr_name = mkInternalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcSpan unwrkr) -- "Template locals" typically used in unfoldings mkTemplateLocals :: [Type] -> [Id] @@ -214,9 +221,10 @@ idPrimRep id = typePrimRep (idType id) \begin{code} recordSelectorFieldLabel :: Id -> (TyCon, FieldLabel) -recordSelectorFieldLabel id = case globalIdDetails id of - RecordSelId tycon lbl _ -> (tycon,lbl) - other -> panic "recordSelectorFieldLabel" +recordSelectorFieldLabel id + = case globalIdDetails id of + RecordSelId { sel_tycon = tycon, sel_label = lbl } -> (tycon,lbl) + other -> panic "recordSelectorFieldLabel" isRecordSelector id = case globalIdDetails id of RecordSelId {} -> True @@ -368,6 +376,20 @@ setIdNewStrictness id sig = modifyIdInfo (`setNewStrictnessInfo` Just sig) id zapIdNewStrictness :: Id -> Id zapIdNewStrictness id = modifyIdInfo (`setNewStrictnessInfo` Nothing) id +\end{code} + +This predicate says whether the id has a strict demand placed on it or +has a type such that it can always be evaluated strictly (e.g., an +unlifted type, but see the comment for isStrictType). We need to +check separately whether has a so-called "strict type" because if +the demand for hasn't been computed yet but has a strict +type, we still want (isStrictId ) to be True. +\begin{code} +isStrictId :: Id -> Bool +isStrictId id + = ASSERT2( isId id, text "isStrictId: not an id: " <+> ppr id ) + (isStrictDmd (idNewDemandInfo id)) || + (isStrictType (idType id)) --------------------------------- -- WORKER ID