[project @ 2001-11-05 16:45:02 by simonpj]
authorsimonpj <unknown>
Mon, 5 Nov 2001 16:45:02 +0000 (16:45 +0000)
committersimonpj <unknown>
Mon, 5 Nov 2001 16:45:02 +0000 (16:45 +0000)
Wibble to eta reduction

ghc/compiler/simplCore/SimplUtils.lhs

index ffeb43c..51504c6 100644 (file)
@@ -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}