From: simonpj Date: Mon, 15 Oct 2001 15:03:48 +0000 (+0000) Subject: [project @ 2001-10-15 15:03:48 by simonpj] X-Git-Tag: Approximately_9120_patches~836 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=3d5a3720e58efcacc7bb9c746f04cb97eabf49a3;p=ghc-hetmet.git [project @ 2001-10-15 15:03:48 by simonpj] Add comments re eta expansion --- diff --git a/ghc/compiler/coreSyn/CorePrep.lhs b/ghc/compiler/coreSyn/CorePrep.lhs index e03683b..5a4b636 100644 --- a/ghc/compiler/coreSyn/CorePrep.lhs +++ b/ghc/compiler/coreSyn/CorePrep.lhs @@ -160,9 +160,11 @@ corePrepRecPairs env pairs bndrs = map fst pairs corePrepRhs :: CloneEnv -> (Id, CoreExpr) -> UniqSM CoreExpr + -- Used for top-level bindings, and local recursive bindings + -- c.f. mkLocalNonRec, which does the other case + -- No nonsense about floating. + -- Prepare the RHS and eta expand it. corePrepRhs env (bndr, rhs) --- Prepare the RHS and eta expand it. --- No nonsense about floating = corePrepAnExpr env rhs `thenUs` \ rhs' -> getUniquesUs `thenUs` \ us -> returnUs (etaExpand (exprArity rhs') us rhs' (idType bndr)) @@ -416,6 +418,9 @@ mkLocalNonRec bndr dem floats rhs -- because floating the case would make it evaluated too early -- -- Finally, eta-expand the RHS, for the benefit of the code gen + -- This might not have happened already, because eta expansion + -- is done by the simplifier only when there at least one lambda already. + -- -- NB: we could refrain when the RHS is trivial (which can happen -- for exported things. This would reduce the amount of code -- generated (a little) and make things a little words for