import CoreSyn
import CoreUtils ( exprArity )
import PprCore ( pprIdRules )
-import Id ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, idType, idCoreRules )
-import IdInfo ( vanillaIdInfo, setArityInfo,
+import Id ( Id, mkUserLocal, idInfo, setIdInfo, idUnique,
+ idType, idCoreRules )
+import IdInfo ( setArityInfo, vanillaIdInfo,
newStrictnessInfo, setAllStrictnessInfo,
newDemandInfo, setNewDemandInfo )
import Type ( tidyType, tidyTyVarBndr )
-> (TidyEnv, CoreBind)
tidyBind env (NonRec bndr rhs)
- = tidyLetBndr env (bndr,rhs) =: \ (env', bndr') ->
+ = tidyLetBndr env (bndr,rhs) =: \ (env', bndr') ->
(env', NonRec bndr' (tidyExpr env' rhs))
tidyBind env (Rec prs)
- = mapAccumL tidyLetBndr env prs =: \ (env', bndrs') ->
+ = mapAccumL tidyLetBndr env prs =: \ (env', bndrs') ->
map (tidyExpr env') (map snd prs) =: \ rhss' ->
(env', Rec (zip bndrs' rhss'))
where
((tidy_env,var_env), new_id) = tidyIdBndr env id
- -- We need to keep around any interesting strictness and demand info
- -- because later on we may need to use it when converting to A-normal form.
+ -- We need to keep around any interesting strictness and
+ -- demand info because later on we may need to use it when
+ -- converting to A-normal form.
-- eg.
-- f (g x), where f is strict in its argument, will be converted
-- into case (g x) of z -> f z by CorePrep, but only if f still
-- CorePrep to turn the let into a case.
--
-- Similarly arity info for eta expansion in CorePrep
+ --
final_id = new_id `setIdInfo` new_info
idinfo = idInfo id
- new_info = vanillaIdInfo
+ new_info = vanillaIdInfo
`setArityInfo` exprArity rhs
`setAllStrictnessInfo` newStrictnessInfo idinfo
`setNewDemandInfo` newDemandInfo idinfo
-- The SrcLoc isn't important now,
-- though we could extract it from the Id
--
- -- All nested Ids now have the same IdInfo, namely none,
+ -- All nested Ids now have the same IdInfo, namely vanillaIdInfo,
-- which should save some space.
-- But note that tidyLetBndr puts some of it back.
ty' = tidyType env (idType id)
id' = mkUserLocal occ' (idUnique id) ty' noSrcLoc
+ `setIdInfo` vanillaIdInfo
var_env' = extendVarEnv var_env id id'
in
((tidy_env', var_env'), id')
\begin{code}
m =: k = m `seq` k m
\end{code}
-
-