summaryrefslogtreecommitdiff
path: root/src/unnest.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-04 09:33:35 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-04 09:33:35 -0500
commit627c93b9779f632bd8d90e7e2de26a5a9c197f08 (patch)
treee40f2a8767966c59e146479de02ec297958fc3c3 /src/unnest.sml
parent24483b49c81a6ac1c99cd28ca3505150b5999863 (diff)
Nested demo
Diffstat (limited to 'src/unnest.sml')
-rw-r--r--src/unnest.sml13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/unnest.sml b/src/unnest.sml
index f226a678..b56daf8a 100644
--- a/src/unnest.sml
+++ b/src/unnest.sml
@@ -137,7 +137,7 @@ fun squishExp (nr, cfv, efv) =
type state = {
maxName : int,
- decls : decl list
+ decls : (string * int * con * exp) list
}
fun kind (k, st) = (k, st)
@@ -278,11 +278,9 @@ fun exp ((ks, ts), e as old, st : state) =
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 unnest file =
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