summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-04-29 20:37:45 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-04-29 20:37:45 -0400
commit88ea557055dc5cb1dcb15aeb65d058132ac24e22 (patch)
treeb9f2ca7f69383251907deef4db600d984cc1d40e
parent4546d4f252f70f87ee86ad2de85f4749171efbfb (diff)
Fix generation of normal datatypes from polymorphic variants
-rw-r--r--src/mono_print.sml3
-rw-r--r--src/monoize.sml2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/mono_print.sml b/src/mono_print.sml
index bf1b0935..e5ef4cf8 100644
--- a/src/mono_print.sml
+++ b/src/mono_print.sml
@@ -400,7 +400,8 @@ fun p_datatype env (x, n, cons) =
let
val env = E.pushDatatype env x n cons
in
- box [string x,
+ box [if !debug then (string (x ^ "__" ^ Int.toString n))
+ else string x,
space,
string "=",
space,
diff --git a/src/monoize.sml b/src/monoize.sml
index 1c11e5c7..6bef134e 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -69,6 +69,8 @@ fun pvar (r, r', loc) =
let
val n = choosePvar ()
val fs = map (fn (x, t) => (x, choosePvar (), t)) r'
+ val r = ListMergeSort.sort (fn (((L.CName x, _), _), ((L.CName y, _), _)) => String.compare (x, y) = GREATER
+ | _ => raise Fail "Monoize: pvar, not CName") r
val (r, fs') = ListPair.foldr (fn ((_, t), (x, n, _), (r, fs')) =>
((x, n, SOME t) :: r,
SM.insert (fs', x, n))) ([], SM.empty) (r, fs)