[project @ 2005-03-09 10:56:09 by simonpj]
[ghc-hetmet.git] / ghc / compiler / cprAnalysis / CprAnalyse.lhs
index 81b2f9e..a41e62f 100644 (file)
@@ -2,6 +2,11 @@
 constructed product result}
 
 \begin{code}
+#ifndef OLD_STRICTNESS
+module CprAnalyse ( ) where
+
+#else
+
 module CprAnalyse ( cprAnalyse ) where
 
 #include "HsVersions.h"
@@ -247,11 +252,11 @@ cprAnalExpr rho (Type t)
 
 cprAnalCaseAlts :: CPREnv -> [CoreAlt] -> ([CoreAlt], AbsVal)
 cprAnalCaseAlts rho alts
-    = foldl anal_alt ([], Bot) alts
+    = foldr anal_alt ([], Bot) alts
       where 
-      anal_alt :: ([CoreAlt], AbsVal) -> CoreAlt -> ([CoreAlt], AbsVal)
-      anal_alt (done, aval) (con, binds, exp) 
-         = (done ++ [(con,binds,exp_cpr)], aval `lub` exp_aval)
+      anal_alt :: CoreAlt -> ([CoreAlt], AbsVal) -> ([CoreAlt], AbsVal)
+      anal_alt (con, binds, exp)  (done, aval)
+         = ((con,binds,exp_cpr) : done, exp_aval `lub` aval)
            where (exp_cpr, exp_aval) = cprAnalExpr rho' exp
                  rho' = rho `extendVarEnvList` (zip binds (repeat Top))
 
@@ -306,4 +311,5 @@ getCprAbsVal v = case idCprInfo v of
                 arity = idArity v
        -- Imported (non-nullary) constructors will have the CPR property
        -- in their IdInfo, so no need to look at their unfolding
+#endif /* OLD_STRICTNESS */
 \end{code}