From d5f79e6e7bab767de9c528ac343132d8daeab0da Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 5 Nov 2001 16:45:02 +0000 Subject: [PATCH] [project @ 2001-11-05 16:45:02 by simonpj] Wibble to eta reduction --- ghc/compiler/simplCore/SimplUtils.lhs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/simplCore/SimplUtils.lhs b/ghc/compiler/simplCore/SimplUtils.lhs index ffeb43c..51504c6 100644 --- a/ghc/compiler/simplCore/SimplUtils.lhs +++ b/ghc/compiler/simplCore/SimplUtils.lhs @@ -546,7 +546,11 @@ tryEtaReduce bndrs body go [] (Var fun) | ok_fun fun = Just (Var fun) -- Success! go _ _ = Nothing -- Failure! - ok_fun fun = not (fun `elem` bndrs) + ok_fun fun = not (fun `elem` bndrs) && + isEvaldUnfolding (idUnfolding fun) + -- The exprIsValue is because eta reduction is not + -- valid in general: \x. bot /= bot + -- So we need to be sure that the "fun" is a value. ok_arg b arg = varToCoreExpr b `cheapEqExpr` arg \end{code} -- 1.7.10.4