diff src/mono_print.sml @ 164:6847741e1f5f

Datatypes through monoize
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 13:32:07 -0400
parents f0d3402184d1
children 25b169416ea8
line wrap: on
line diff
--- a/src/mono_print.sml	Tue Jul 29 13:16:21 2008 -0400
+++ b/src/mono_print.sml	Tue Jul 29 13:32:07 2008 -0400
@@ -162,9 +162,28 @@
              p_exp env e]
     end
 
+fun p_datatype env (x, n, cons) =
+    let
+        val env = E.pushTNamed env x n NONE
+    in
+        box [string "datatype",
+             space,
+             string x,
+             space,
+             string "=",
+             space,
+             p_list_sep (box [space, string "|", space])
+                        (fn (x, n, NONE) => if !debug then (string (x ^ "__" ^ Int.toString n))
+                                            else string x
+                          | (x, _, SOME t) => box [if !debug then (string (x ^ "__" ^ Int.toString n))
+                                                   else string x, space, string "of", space, p_typ env t])
+                        cons]
+    end
+
 fun p_decl env (dAll as (d, _) : decl) =
     case d of
-        DVal vi => box [string "val",
+        DDatatype x => p_datatype env x
+      | DVal vi => box [string "val",
                         space,
                         p_vali env vi]
       | DValRec vis =>