summaryrefslogtreecommitdiff
path: root/src/core_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 09:00:28 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 09:00:28 -0400
commit652ca797f5c9de9adc198df0c0e8a706807328a6 (patch)
treed169fb294b36335dbe40525678328c7b0dc21c13 /src/core_util.sml
parent773cc619b71ad10b8f21f6941d67947bac86885f (diff)
Corify tables
Diffstat (limited to 'src/core_util.sml')
-rw-r--r--src/core_util.sml13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core_util.sml b/src/core_util.sml
index 3403a9d1..609152ec 100644
--- a/src/core_util.sml
+++ b/src/core_util.sml
@@ -621,6 +621,10 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, decl = fd, bind} =
(DValRec vis', loc))
end
| DExport _ => S.return2 dAll
+ | DTable (x, n, c, s) =>
+ S.map2 (mfc ctx c,
+ fn c' =>
+ (DTable (x, n, c', s), loc))
and mfvi ctx (x, n, t, e, s) =
S.bind2 (mfc ctx t,
@@ -703,6 +707,12 @@ fun mapfoldB (all as {bind, ...}) =
foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s)))
ctx vis
| DExport _ => ctx
+ | DTable (x, n, c, s) =>
+ let
+ val t = (CApp ((CFfi ("Basis", "table"), #2 d'), c), #2 d')
+ in
+ bind (ctx, NamedE (x, n, t, NONE, s))
+ end
in
S.map2 (mff ctx' ds',
fn ds' =>
@@ -750,7 +760,8 @@ val maxName = foldl (fn ((d, _) : decl, count) =>
| DDatatype (_, n, _, _) => Int.max (n, count)
| DVal (_, n, _, _, _) => Int.max (n, count)
| DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis
- | DExport _ => count) 0
+ | DExport _ => count
+ | DTable (_, n, _, _) => Int.max (n, count)) 0
end