[Add comments and type signatures to Grin/
Einar Karttunen <ekarttun@cs.helsinki.fi>**20060724155907] hunk ./Grin/DeadCode.hs 24
+-- | Remove dead code from Grin.
hunk ./Grin/EvalInline.hs 9
-import Char
hunk ./Grin/EvalInline.hs 14
+
hunk ./Grin/EvalInline.hs 18
-import Support.FreeVars
-import Support.CanType
+import Support.FreeVars(freeVars)
+import Support.CanType(getType)
hunk ./Grin/Grin.hs 97
+gEval :: Val -> Exp
hunk ./Grin/Grin.hs 99
+gApply :: Val -> Val -> Exp
hunk ./Grin/Grin.hs 152
-     Exp :>>= Lam
-    | App { expFunction :: Atom, expArgs :: [Val], expType :: Ty }    -- ^ this handles applications of functions and builtins
-    | Prim { expPrimitive :: Primitive, expArgs :: [Val] }
-    | Case { expValue :: Val, expAlts :: [Lam] }
-    | Return { expValue :: Val }
-    | Store { expValue :: Val }
-    | Fetch { expAddress :: Val }
-    | Update { expAddress :: Val, expValue :: Val }
-    | Error { expError :: String, expType :: Ty }      -- ^ abort with an error message, non recoverably.
+     Exp :>>= Lam                                                   -- ^ Sequencing - the same as >>= for monads.
+    | App { expFunction :: Atom, expArgs :: [Val], expType :: Ty }  -- ^ Application of functions and builtins
+    | Prim { expPrimitive :: Primitive, expArgs :: [Val] }          -- ^ Primitive operation
+    | Case { expValue :: Val, expAlts :: [Lam] }                    -- ^ Case statement
+    | Return { expValue :: Val }                                    -- ^ Return a value
+    | Store { expValue :: Val }                                     -- ^ Allocate a new heap node
+    | Fetch { expAddress :: Val }                                   -- ^ Load given heap node
+    | Update { expAddress :: Val, expValue :: Val }                 -- ^ Update given heap node
+    | Error { expError :: String, expType :: Ty }                   -- ^ Abort with an error message, non recoverably.
hunk ./Grin/Grin.hs 164
-    NodeC !Tag [Val]
-    | NodeV !Var [Val]
-    | Tag !Tag
-    | Const Val         -- ^ pointer to constant data, only Lit, Tag, and NodeC may be children
-    | Lit !Number Ty
-    | Var !Var Ty
-    | Tup [Val]
-    | ValPrim APrim [Val] Ty
-    | Addr {-# UNPACK #-} !(IORef Val)  -- used only in interpreter
+    NodeC !Tag [Val]          -- ^ Complete node with constant tag
+    | NodeV !Var [Val]        -- ^ Complete node with variable tag
+    | Tag !Tag                -- ^ Single tag
+    | Const Val               -- ^ pointer to constant data, only Lit, Tag, and NodeC may be children
+    | Lit !Number Ty          -- ^ Literal
+    | Var !Var Ty             -- ^ Variable
+    | Tup [Val]               -- ^ Unboxed tuple
+    | ValPrim APrim [Val] Ty  -- ^ Primitive value
+    | Addr {-# UNPACK #-} !(IORef Val)  -- ^ Used only in interpreter
hunk ./Grin/Grin.hs 653
+modifyTail :: Lam -> Exp -> Exp
hunk ./Grin/Grin.hs 661
-ref_tag =  (toAtom "CData.IORef.IORef")
-
-isMutableNodeTag t = t == ref_tag
+-- | Is type mutable (currently IORef)
+isMutableNodeTag :: Tag -> Bool
+isMutableNodeTag t = t == ref_tag where ref_tag = toAtom "CData.IORef.IORef"
hunk ./Grin/Grin.hs 665
+-- | Is a Val constant?