diff src/mono_print.sml @ 126:76a4d69719d8

Tagging (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:38:03 -0400
parents 6230bdd122e7
children 78d59cf0a0cc
line wrap: on
line diff
--- a/src/mono_print.sml	Thu Jul 17 10:23:04 2008 -0400
+++ b/src/mono_print.sml	Thu Jul 17 10:38:03 2008 -0400
@@ -138,32 +138,44 @@
 
 and p_exp env = p_exp' false env
 
-fun p_decl env ((d, _) : decl) =
+fun p_vali env (x, n, t, e, s) =
+    let
+        val xp = if !debug then
+                     box [string x,
+                          string "__",
+                          string (Int.toString n)]
+                 else
+                     string x        
+    in
+        box [xp,
+             space,
+             string "as",
+             space,
+             string s,
+             space,
+             string ":",
+             space,
+             p_typ env t,
+             space,
+             string "=",
+             space,
+             p_exp env e]
+    end
+
+fun p_decl env (dAll as (d, _) : decl) =
     case d of
-        DVal (x, n, t, e, s) =>
+        DVal vi => box [string "val",
+                        space,
+                        p_vali env vi]
+      | DValRec vis =>
         let
-            val xp = if !debug then
-                         box [string x,
-                              string "__",
-                              string (Int.toString n)]
-                     else
-                         string x        
+            val env = E.declBinds env dAll
         in
             box [string "val",
                  space,
-                 xp,
+                 string "rec",
                  space,
-                 string "as",
-                 space,
-                 string s,
-                 space,
-                 string ":",
-                 space,
-                 p_typ env t,
-                 space,
-                 string "=",
-                 space,
-                 p_exp env e]
+                 p_list_sep (box [newline, string "and", space]) (p_vali env) vis]
         end
 
       | DExport (s, n, ts) => box [string "export",