changeset 1734:d2b3fada532e

Fix generation of normal datatypes from polymorphic variants
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 Apr 2012 20:37:45 -0400
parents ab24a7cb2a64
children ec47f49c6aa3
files src/mono_print.sml src/monoize.sml
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/mono_print.sml	Sun Apr 29 16:23:03 2012 -0400
+++ b/src/mono_print.sml	Sun Apr 29 20:37:45 2012 -0400
@@ -400,7 +400,8 @@
     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,
--- a/src/monoize.sml	Sun Apr 29 16:23:03 2012 -0400
+++ b/src/monoize.sml	Sun Apr 29 20:37:45 2012 -0400
@@ -69,6 +69,8 @@
         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)