changeset 1298:e665527fce1c

Support empty datatypes, which can now be generated via 'variant []'
author Adam Chlipala <adam@chlipala.net>
date Thu, 09 Sep 2010 12:42:25 -0400
parents 41484478a32d
children 3c334458c84f
files src/cjr_print.sml src/mono_reduce.sml
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cjr_print.sml	Tue Sep 07 09:47:06 2010 -0400
+++ b/src/cjr_print.sml	Thu Sep 09 12:42:25 2010 -0400
@@ -2011,8 +2011,11 @@
                      space,
                      string "{",
                      space,
-                     p_list_sep (box [string ",", space]) (fn (x, n, _) =>
-                                                              string ("__uwc_" ^ ident x ^ "_" ^ Int.toString n)) xncs,
+                     case xncs of
+                         [] => string ("__uwec_" ^ ident x ^ "_" ^ Int.toString n)
+                       | _ =>
+                         p_list_sep (box [string ",", space]) (fn (x, n, _) =>
+                                                                  string ("__uwc_" ^ ident x ^ "_" ^ Int.toString n)) xncs,
                      space,
                      string "};"]
               | p_one (Option, _, _, _) = box []
--- a/src/mono_reduce.sml	Tue Sep 07 09:47:06 2010 -0400
+++ b/src/mono_reduce.sml	Thu Sep 09 12:42:25 2010 -0400
@@ -436,7 +436,7 @@
                             val lss = map (fn (p, e) => summarize (d + patBinds p) e) pes
                         in
                             case lss of
-                                [] => raise Fail "Empty pattern match"
+                                [] => summarize d e
                               | ls :: lss =>
                                 summarize d e
                                 @ (if List.all (fn ls' => ls' = ls) lss then