[make analyze handle all E cases explicitly. use absent rather than lazy types for unknown values, handle top level recursion properly.
John Meacham <john@repetae.net>**20060718015956] hunk ./E/Demand.hs 6
+    absSig,
hunk ./E/Demand.hs 91
+absSig = DemandSignature 0 absType
hunk ./E/Demand.hs 227
-analyze el@(ELit LitCons { litName = h, litArgs = ts@(_:_) }) (S (Product ss)) | length ss == length ts = do
+analyze el@(ELit lc@LitCons { litName = h, litArgs = ts@(_:_) }) (S (Product ss)) | length ss == length ts = do
hunk ./E/Demand.hs 235
-        _ -> return (el,absType)
+        _ -> do
+            rts <- mapM (\e -> analyze e lazy) ts
+            return (ELit lc { litArgs = fsts rts }, foldr glb absType (snds rts))
hunk ./E/Demand.hs 285
-analyze e _ = return (e,absType)
+analyze Unknown _ = return (Unknown,absType)
+analyze es@ESort {} _ = return (es,absType)
+analyze es@(ELit LitInt {}) _ = return (es,absType)
+analyze e x = fail $ "analyze: " ++ show (e,x)
+
hunk ./E/Demand.hs 307
-topAnalyze tvr e | getProperty prop_PLACEHOLDER tvr = return (e,lazySig)
+topAnalyze tvr e | getProperty prop_PLACEHOLDER tvr = return (e,DemandSignature 0 absType)
hunk ./E/Demand.hs 318
-    let f (rec,ds) = do
-            flip mapM ds $ \ (t,e) -> case (runIM (topAnalyze t e) (progDataTable prog)) of
-                Identity (ne,s) -> do
-                    let s' = fixupDemandSignature s
-                    putStrLn $ "strictness: " ++ pprint t ++ ": " ++ show s'
-                    return (tvrInfo_u (Info.insert s') t,ne)
+    let f (False,[(t,e)]) = do
+            (ne,s) <- runIM (topAnalyze t e) (progDataTable prog)
+            let s' = fixupDemandSignature s
+            putStrLn $ "strictness: " ++ pprint t ++ ": " ++ show s'
+            return [(tvrInfo_u (Info.insert s') t,ne)]
+        f (True,ds) = do
+            let ds' = [ ((t,e),sig) | (t,e) <- ds, let sig = maybe absSig id (Info.lookup (tvrInfo t))]
+                g False [] ds = return [ (tvrInfo_u (Info.insert (fixupDemandSignature sig)) t,e) | ((t,e),sig) <- ds ]
+                g True [] ds = extEnvs [ (t,sig)| ((t,_),sig) <- ds] $ g False ds []
+                g ch (((t,e),sig):rs) fs = do
+                    (ne,sig') <- topAnalyze t e
+                    g (ch || (sig' /= sig)) rs (((t,ne),sig'):fs)
+            runIM (g True [] ds') (progDataTable prog)
hunk ./E/WorkerWrapper.hs 35
-    Demand.DemandSignature _ (_ Demand.:=> sa) = maybe Demand.lazySig id (Info.lookup (tvrInfo tvr))
+    Demand.DemandSignature _ (_ Demand.:=> sa) = maybe Demand.absSig id (Info.lookup (tvrInfo tvr))