[clean up worker wrapper code, prepare for taking advantage of substructure and abscence information.
John Meacham <john@repetae.net>**20060719005057] hunk ./E/WorkerWrapper.hs 1
-module E.WorkerWrapper(workWrap,performWorkWrap) where
+module E.WorkerWrapper(performWorkWrap) where
hunk ./E/WorkerWrapper.hs 28
+data Arg =
+    Absent
+    | Cons Constructor [(Arg,TVr)]
+    | Plain
+
+isPlain Plain = True
+isPlain _ = False
+
hunk ./E/WorkerWrapper.hs 40
-    -> m (Maybe Name,E,[(Maybe (Constructor,[TVr]),TVr)])  -- ^ (Body,Args)
+    -> m (Maybe Name,E,[(Arg,TVr)])  -- ^ (CPR Constructor,Body,Args)
hunk ./E/WorkerWrapper.hs 46
-       | Just con <- getProduct dataTable tt = f e ss x ((Just (con,as con),t):ts)
+       | Just con <- getProduct dataTable tt = f e ss x ((Cons con (as con),t):ts)
hunk ./E/WorkerWrapper.hs 48
-            as con = [ t { tvrIdent = n, tvrType = st } | st <- slotTypes dataTable (conName con) tt | n <- tmpNames Val (tvrIdent t) ]
+            as con = [ (Plain,t { tvrIdent = n, tvrType = st }) | st <- slotTypes dataTable (conName con) tt | n <- tmpNames Val (tvrIdent t) ]
hunk ./E/WorkerWrapper.hs 50
-    f (ELam t e) (_:ss) (Fun x) ts = f e ss x ((Nothing,t):ts)
+    f (ELam t e) (_:ss) (Fun x) ts = f e ss x ((Plain,t):ts)
hunk ./E/WorkerWrapper.hs 53
-    f e _ _ ts | any (isJust . fst) ts = return (Nothing ,e,reverse ts)
+    f e _ _ ts | any (not . isPlain . fst) ts = return (Nothing ,e,reverse ts)
hunk ./E/WorkerWrapper.hs 59
-workWrap = undefined
-
-{-
-workWrap dataTable tvr e = case workWrap' dataTable tvr e of
-    Nothing -> [(tvr,e)]
-    Just (x,y) -> [x,y]
--}
hunk ./E/WorkerWrapper.hs 75
-        f (Nothing,t) = [t]
-        f (Just (c,ts),_) = ts
+        f (Plain,t) = [t]
+        f (Cons c ts,_) = concatMap f ts
hunk ./E/WorkerWrapper.hs 78
-        f (Nothing,_) = []
-        f (Just (c,ts),t) = [(t,ELit (LitCons (conName c) (map EVar ts) (getType t)))]
+        f (Plain,_) = []
+        f (Cons c ts,t) = [(t,ELit (LitCons (conName c) (map EVar (snds ts)) (getType t)))] ++ concatMap f ts
hunk ./E/WorkerWrapper.hs 82
-        f ((Nothing,_):rs) = f rs
-        f ((Just (c,ts),t):rs) = eCase (EVar t) [Alt (LitCons (conName c) ts (getType t)) (f rs)] Unknown
+        f ((Plain,_):rs) = f rs
+        f ((Cons c ts,t):rs) = eCase (EVar t) [Alt (LitCons (conName c) (snds ts) (getType t)) (f (ts ++ rs))] Unknown
hunk ./E/WorkerWrapper.hs 105
-    needsArg =  all (isJust . fst) sargs && null (concat [ xs | (Just (_,xs),_) <- sargs])
+    --needsArg =  all (isJust . fst) sargs && null (concat [ xs | (Just (_,xs),_) <- sargs])
+    needsArg = null args'
hunk ./E/WorkerWrapper.hs 115
-            (Just (n,_),_) ->  mtick ("E.Workwrap.arg.{"  ++ show (conName n) ++ "}")
+            (Cons n _,_) -> mtick ("E.Workwrap.arg.{"  ++ show (conName n) ++ "}")
+            (Absent,_) -> mtick "E.Workwrap.arg.absent"