summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-09-09 12:42:25 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2010-09-09 12:42:25 -0400
commit5ee58ab372255fea4b1180b7af3c7fc5485ccb1c (patch)
tree691773c8f6432547bb7ae6cfd50a46cef9e527dc
parent2f0548ba477493e865a75594fceb0cb107869510 (diff)
Support empty datatypes, which can now be generated via 'variant []'
-rw-r--r--src/cjr_print.sml7
-rw-r--r--src/mono_reduce.sml2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 5282ddc2..ae347eb2 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -2011,8 +2011,11 @@ fun p_decl env (dAll as (d, _) : decl) =
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 []
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml
index ce9f4a4e..59ec5a55 100644
--- a/src/mono_reduce.sml
+++ b/src/mono_reduce.sml
@@ -436,7 +436,7 @@ fun reduce file =
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