Typechecking for basic language done
[hcoop/domtool2.git] / src / print.sml
index 7f182b9..1f661dd 100644 (file)
@@ -59,6 +59,11 @@ fun p_typ' pn (t, _) =
       | TAction (p, r1, r2) =>
        parenIf pn [p_predBoxed p, space 1, p_record r1, space 1,
                    string "->", space 1, p_record r2]
+
+      | TError => string "<error>"
+      | TUnif (_, ref (SOME t)) => p_typ' pn t
+      | TUnif (name, ref NONE) => string ("<" ^ name ^ ">")
+
 and p_record r =
     case StringMap.foldri (fn (name, t, d) =>
                              SOME (case d of
@@ -86,10 +91,13 @@ fun p_exp (e, _) =
             NONE => string "[]"
           | SOME d => dBox [string "[", d, string "]"])
 
-      | ELam (x, t, e) => dBox [string "(\\", space 1, string x, space 1,
+      | ELam (x, NONE, e) => dBox [string "(\\", space 1, string x, space 1,
+                               string "->", space 1, p_exp e, string ")"]
+      | ELam (x, SOME t, e) => dBox [string "(\\", space 1, string x, space 1,
                                string ":", space 1,
                                dBox [string "(", p_typ t, string ")"],
                                space 1, string "->", space 1, p_exp e, string ")"]
+
       | EVar x => string x
       | EApp (e1, e2) => dBox [string "(", p_exp e1, break {nsp = 1, offset = 0}, p_exp e2, string ")"]
 
@@ -107,7 +115,7 @@ fun p_exp (e, _) =
                                           string "end"]
       | ELocal _ => raise Fail "Unexpected ELocal form"
 
-fun print d =
+fun printd d =
     let
        val myStream = SM.openOut {dst = TextIO.stdOut,
                                   wid = 80}