diff src/unnest.sml @ 455:d4a81273d4b1

Nested demo
author Adam Chlipala <adamc@hcoop.net>
date Tue, 04 Nov 2008 09:33:35 -0500
parents 787d4931fb07
children f542bc3133dc
line wrap: on
line diff
--- a/src/unnest.sml	Sat Nov 01 21:24:43 2008 -0400
+++ b/src/unnest.sml	Tue Nov 04 09:33:35 2008 -0500
@@ -137,7 +137,7 @@
 
 type state = {
      maxName : int,
-     decls : decl list
+     decls : (string * int * con * exp) list
 }
 
 fun kind (k, st) = (k, st)
@@ -278,11 +278,9 @@
                                               end)
                                           vis
 
-                            val d = (DValRec vis, #2 ed)
-
                             val ts = map (fn (x, _, t, _) => (x, t)) vis @ ts
                         in
-                            ([], (ts, maxName, d :: ds, subs))
+                            ([], (ts, maxName, vis @ ds, subs))
                         end)
                 (ts, #maxName st, #decls st, []) eds
         in
@@ -319,8 +317,13 @@
                 fun explore () =
                     let
                         val (d, st) = unnestDecl st all
+
+                        val ds =
+                            case #1 d of
+                                DValRec vis => [(DValRec (vis @ #decls st), #2 d)]
+                              | _ => [(DValRec (#decls st), #2 d), d]
                     in
-                        (rev (d :: #decls st),
+                        (ds,
                          {maxName = #maxName st,
                           decls = []})
                     end