diff src/core_print.sml @ 192:9bbf4d383381

Parametrized datatypes through corify
author Adam Chlipala <adamc@hcoop.net>
date Fri, 08 Aug 2008 10:59:06 -0400
parents 8e9f97508f0d
children 8a70e2919e86
line wrap: on
line diff
--- a/src/core_print.sml	Fri Aug 08 10:28:32 2008 -0400
+++ b/src/core_print.sml	Fri Aug 08 10:59:06 2008 -0400
@@ -173,10 +173,10 @@
         PWild => string "_"
       | PVar (s, _) => string s
       | PPrim p => Prim.p_t p
-      | PCon (_, n, NONE) => p_patCon env n
-      | PCon (_,n, SOME p) => parenIf par (box [p_patCon env n,
-                                                space,
-                                                p_pat' true env p])
+      | PCon (_, n, _, NONE) => p_patCon env n
+      | PCon (_, n, _, SOME p) => parenIf par (box [p_patCon env n,
+                                                    space,
+                                                    p_pat' true env p])
       | PRecord xps =>
         box [string "{",
              p_list_sep (box [string ",", space]) (fn (x, p, _) =>
@@ -199,10 +199,10 @@
               string (#1 (E.lookupERel env n)))
          handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n))
       | ENamed n => p_enamed env n
-      | ECon (_, pc, NONE) => p_patCon env pc
-      | ECon (_, pc, SOME e) => parenIf par (box [p_patCon env pc,
-                                                  space,
-                                                  p_exp' true env e])
+      | ECon (_, pc, _, NONE) => p_patCon env pc
+      | ECon (_, pc, _, SOME e) => parenIf par (box [p_patCon env pc,
+                                                     space,
+                                                     p_exp' true env e])
       | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
       | EFfiApp (m, x, es) => box [string "FFI(",
                                    string m,
@@ -344,13 +344,16 @@
         Link => string "link"
       | Action => string "action"
 
-fun p_datatype env (x, n, cons) =
+fun p_datatype env (x, n, xs, cons) =
     let
+        val k = (KType, ErrorMsg.dummySpan)
         val env = E.pushCNamed env x n (KType, ErrorMsg.dummySpan) NONE
+        val env = foldl (fn (x, env) => E.pushCRel env x k) env xs
     in
         box [string "datatype",
              space,
              string x,
+             p_list_sep (box []) (fn x => box [space, string x]) xs,
              space,
              string "=",
              space,