[remove special 'funcEval' and 'funcApply' giving them their own BaseOps
John Meacham <john@repetae.net>**20090709014156
 Ignore-this: bbb92f1e48cae956e7f351e34857155e
] hunk ./C/FromGrin2.hs 541
-convertExp (App a [v] _) | a == funcEval = do
+convertExp (BaseOp Eval [v]) = do
hunk ./Grin/DeadCode.hs 110
-            g (App a [e] _)   | a == funcEval =  addRule (doNode e)
-            g (App a [x,y] _) | a == funcApply =  addRule (doNode x `mappend` doNode y)
-            g (App a [x] _)   | a == funcApply =  addRule (doNode x)
+            g (BaseOp Eval [e]) =  addRule (doNode e)
+            g (BaseOp Apply {} vs) =  addRule (mconcatMap doNode vs)
hunk ./Grin/DeadCode.hs 168
-    f (App fn as ty) | fn `notElem` [funcApply, funcEval] = do
+    f (App fn as ty)  = do
hunk ./Grin/EvalInline.hs 142
-        g (App fn [fun] ty) | fn == funcApply = do
+        g (BaseOp (Apply ty) [fun]) = do
hunk ./Grin/EvalInline.hs 147
-        g (App fn [fun,arg] ty) | fn == funcApply = do
+        g (BaseOp (Apply ty) [fun,arg]) = do
hunk ./Grin/FromE.hs 278
-    (funcEval, ([tyINode],[tyDNode])),
hunk ./Grin/FromE.hs 338
-doApply x y ty | not (keepIt y) = App funcApply [x] ty
-doApply x y ty = App funcApply [x,y] ty
+doApply x y ty | not (keepIt y) = BaseOp (Apply ty) [x]
+doApply x y ty = BaseOp (Apply ty) [x,y]
hunk ./Grin/FromE.hs 356
-        Nothing -> return $ App funcEval [toVal tvr] fty
+        Nothing -> return $ gEval (toVal tvr)
hunk ./Grin/FromE.hs 562
-        return (e :>>= [v] :-> App funcApply [v] ty)
+        return (e :>>= [v] :-> BaseOp (Apply ty) [v])
hunk ./Grin/FromE.hs 568
-        app ty (e :>>= [v] :-> App funcApply [v] [TyNode]) as
+        app ty (e :>>= [v] :-> BaseOp (Apply [TyNode]) [v]) as
hunk ./Grin/Grin.hs 31
-    funcApply,
-    funcEval,
hunk ./Grin/Grin.hs 103
-funcApply = toAtom "@apply"
-funcEval = toAtom "@eval"
hunk ./Grin/Grin.hs 105
-gEval x = App funcEval [x] [TyNode]
+gEval x = BaseOp Eval [x]
hunk ./Grin/Grin.hs 169
-    | Apply                 -- apply a partial application to a value
+    | Apply [Ty]            -- apply a partial application to a value, returning the given type
hunk ./Grin/Grin.hs 510
+    getType (BaseOp Eval _) = [TyNode]
+    getType (BaseOp (Apply ty) _) = ty
hunk ./Grin/Lint.hs 137
-    f [b] (App ev [x] _) | ev == funcEval  = do assign "eval" b x
+    f [b] (BaseOp Eval [x]) = do assign "eval" b x
hunk ./Grin/Lint.hs 258
-    f ap@(App fn [v,a] t) | fn == funcApply = do
-        [v',a'] <- mapM tcVal [v,a]
+    f ap@(BaseOp (Apply t) vs) = do
+        (v':_) <- mapM tcVal vs
hunk ./Grin/Lint.hs 262
-    f ap@(App fn [v] t) | fn == funcApply = do
+    f ap@(BaseOp Eval [v]) = do
hunk ./Grin/Lint.hs 264
-        if v' == TyNode then return t
-         else fail $ "App apply arg doesn't match: " ++ show ap
-    f ap@(App fn [v] t) | fn == funcEval = do
-        v' <- tcVal v
-        if v' == tyINode then return t
+        if v' == tyINode then return [TyNode]
hunk ./Grin/Lint.hs 295
---    f e@(Update w v) = do
---        (TyPtr t) <- tcVal w
---        t' <- tcVal v
---        same (show e) t t'
---        return []
hunk ./Grin/NodeAnalyze.hs 194
-        f (App { expFunction = fn, expArgs = [x] }) | fn == funcEval = do
+        f (BaseOp Eval [x]) = do
hunk ./Grin/NodeAnalyze.hs 196
-        f (App { expFunction = fn, expArgs = [x], expType = ty }) | fn == funcApply = do
-            convertVal x
-            dunno ty
-        f (App { expFunction = fn, expArgs = [x,y], expType = ty }) | fn == funcApply = do
-            convertVal x
-            convertVal y
+        f (BaseOp (Apply ty) xs) = do
+            mapM_ convertVal xs
hunk ./Grin/NodeAnalyze.hs 297
-    f a@App { expFunction = fn, expArgs = [arg] } | fn == funcEval, Just n <- lupVar arg = case n of
+    f a@(BaseOp Eval [arg]) | Just n <- lupVar arg = case n of
hunk ./Grin/SSimplify.hs 82
-        (App fap (Var (V vn) _:fs) ty) | fap == funcApply, Just (tl,gs) <- IM.lookup vn pmap -> do
+        (BaseOp (Apply ty) (Var (V vn) _:fs)) | Just (tl,gs) <- IM.lookup vn pmap -> do
hunk ./Grin/SSimplify.hs 103
-    f p app@(App a [v] _) | a == funcEval =  cse' "Simplify.CSE.eval" [(BaseOp Promote [v],Return p)]
+    f p app@(BaseOp Eval [v]) =  cse' "Simplify.CSE.eval" [(BaseOp Promote [v],Return p)]
hunk ./Grin/SSimplify.hs 132
-    f (App a [Const n] _) rs | a == funcEval = do
+    f (BaseOp Eval [Const n]) rs = do
hunk ./Grin/Show.hs 79
-prettyExp vl (App t [v] _) | t == funcEval = vl <> keyword "eval" <+> prettyVal v
-prettyExp vl (App t [a] _) | t == funcApply = vl <> keyword "apply" <+> prettyVal a
-prettyExp vl (App t [a,b] _) | t == funcApply = vl <> keyword "apply" <+> prettyVal a <+> prettyVal b
+prettyExp vl (BaseOp Eval [v]) = vl <> keyword "eval" <+> prettyVal v
+prettyExp vl (BaseOp Apply {} vs) = vl <> keyword "apply" <+> hsep (map prettyVal vs)
hunk ./Grin/Simplify.hs 96
-    gs (App a [Const n] typ) | a == funcEval = do
+    gs (BaseOp Eval [Const n]) = do