+tidyLetBndr :: TidyEnv -> (Id, CoreExpr) -> (TidyEnv, Var)
+-- Used for local (non-top-level) let(rec)s
+tidyLetBndr env (id,rhs)
+ = ((tidy_env,new_var_env), final_id)
+ 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.
+ -- 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
+ -- has its strictness info.
+ --
+ -- Similarly for the demand info - on a let binder, this tells
+ -- 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
+ `setArityInfo` exprArity rhs
+ `setAllStrictnessInfo` newStrictnessInfo idinfo
+ `setNewDemandInfo` newDemandInfo idinfo
+
+ -- Override the env we get back from tidyId with the new IdInfo
+ -- so it gets propagated to the usage sites.
+ new_var_env = extendVarEnv var_env id final_id
+
+-- Non-top-level variables
+tidyIdBndr :: TidyEnv -> Id -> (TidyEnv, Id)
+tidyIdBndr env@(tidy_env, var_env) id
+ = -- do this pattern match strictly, otherwise we end up holding on to
+ -- stuff in the OccName.
+ case tidyOccName tidy_env (getOccName id) of { (tidy_env', occ') ->