[add CanType instance for Val
John Meacham <john@repetae.net>**20051005042008] hunk ./Grin/Grin.hs 44
-import Atom
-import Boolean.Algebra
hunk ./Grin/Grin.hs 46
-import C.Prims
hunk ./Grin/Grin.hs 48
-import Doc.DocLike
-import FreeVars
-import GenUtil
hunk ./Grin/Grin.hs 49
-import Number
hunk ./Grin/Grin.hs 52
+
+import Atom
+import Boolean.Algebra
+import CanType
+import C.Prims
+import Doc.DocLike
+import FreeVars
+import GenUtil
+import Number
hunk ./Grin/Grin.hs 511
+instance CanType Val Ty where
+    getType (Tag _) = TyTag
+    getType (Var _ t) = t
+    getType (Lit _ t) = t
+    getType (NodeV {}) = TyNode
+    getType (Tup xs) = TyTup (map getType xs)
+    getType (Const t) = TyPtr (getType t)
+    getType (NodeC {}) = TyNode
+    getType (Addr _) = TyPtr (error "typecheck: Addr")
+    getType (ValPrim _) = error "ValPrim"