[simplify demand code using SubDemand type
John Meacham <john@repetae.net>**20060713014115] hunk ./E/Demand.hs 33
-    | S       -- strict
-    | Sp [Demand]  -- product or function type
+    | S SubDemand      -- strict
hunk ./E/Demand.hs 39
-    showsPrec _ S = ('S':)
-    showsPrec _ (Sp ds) = showString "S(" . foldr (.) id (map shows ds) . showString ")"
+    showsPrec _ (S None) = ('S':)
+    showsPrec _ (S (Product ds)) = showString "S(" . foldr (.) id (map shows ds) . showString ")"
hunk ./E/Demand.hs 45
-data SubDemand = None | Fun Demand | Product [Demand]
-    deriving(Show)
+data SubDemand = None | Product [Demand]
+    deriving(Eq,Ord,Typeable)
hunk ./E/Demand.hs 82
-    sp' True [] = S
-    sp' False [] = Sp s
+    sp' True [] = S None
+    sp' False [] = S (Product s)
hunk ./E/Demand.hs 98
-    lub S S = S
-    lub (Sp _) S = S
-    lub S (Sp _) = S
-    lub (Sp xs) (Sp ys) | length xs == length ys = sp (zipWith lub xs ys)
+    lub (S (Product xs)) (S (Product ys)) | length xs == length ys = sp (zipWith lub xs ys)
+    lub (S _) (S _) = S None
hunk ./E/Demand.hs 106
-    glb S S = S
+    glb (S None) (S None) = S None
hunk ./E/Demand.hs 109
-sargs S = repeat L
-sargs (Sp xs) = xs
+sargs (S None) = repeat L
+sargs (S (Product xs)) = xs
hunk ./E/Demand.hs 153
-            f n (Sp [s]) = f (n - 1) s
+            f n (S (Product [s])) = f (n - 1) s
hunk ./E/Demand.hs 165
-    (e1',phi1 :=> sigma1') <- analyze e1 (Sp [s])
+    (e1',phi1 :=> sigma1') <- analyze e1 (sp [s])
hunk ./E/Demand.hs 169
-analyze el@(ELit LitCons { litName = h, litArgs = ts@(_:_) }) (Sp ss) | length ss == length ts = do
+analyze el@(ELit LitCons { litName = h, litArgs = ts@(_:_) }) (S (Product ss)) | length ss == length ts = do
hunk ./E/Demand.hs 179
-analyze (ELam x e) (Sp [s]) = do
+analyze (ELam x e) (S (Product [s])) = do
hunk ./E/Demand.hs 183
-analyze (ELam x e) S = analyze (ELam x e) (Sp [L])
+analyze (ELam x e) (S None) = analyze (ELam x e) (S (Product [L]))  -- simply to ensure binder is annotated
hunk ./E/Demand.hs 214
-
-
-
-
hunk ./E/Demand.hs 216
+
hunk ./E/Demand.hs 222
-    (ecs,env :=> _) <- analyze (eCaseScrutinee ec') S
+    (ecs,env :=> _) <- analyze (eCaseScrutinee ec') (S None)
hunk ./E/Demand.hs 232
-topAnalyze e = clam e S 0 where
-    clam (ELam _ x) s n = clam x (Sp [s]) (n + 1)
+topAnalyze e = clam e (S None) 0 where
+    clam (ELam _ x) s n = clam x (sp [s]) (n + 1)