comparison src/elaborate.sml @ 1225:950d1e540df6

Tweaks to table signatures and MonoOpt summarizing
author Adam Chlipala <adamc@hcoop.net>
date Sun, 11 Apr 2010 14:11:17 -0400
parents c316ca3c9ec6
children 79b2bcac6200
comparison
equal deleted inserted replaced
1224:3950cf1f5736 1225:950d1e540df6
2235 end 2235 end
2236 2236
2237 | L.SgiTable (x, c, pe, ce) => 2237 | L.SgiTable (x, c, pe, ce) =>
2238 let 2238 let
2239 val cstK = (L'.KRecord (L'.KRecord (L'.KUnit, loc), loc), loc) 2239 val cstK = (L'.KRecord (L'.KRecord (L'.KUnit, loc), loc), loc)
2240 val x' = x ^ "_hidden_constraints"
2241 val (env', hidden_n) = E.pushCNamed env x' cstK NONE
2242 val hidden = (L'.CNamed hidden_n, loc)
2243 2240
2244 val (c', ck, gs') = elabCon (env, denv) c 2241 val (c', ck, gs') = elabCon (env, denv) c
2245 val pkey = cunif (loc, cstK) 2242 val pkey = cunif (loc, cstK)
2246 val visible = cunif (loc, cstK) 2243 val visible = cunif (loc, cstK)
2247 val uniques = (L'.CConcat (visible, hidden), loc) 2244 val (env', ds, uniques) =
2245 case (#1 pe, #1 ce) of
2246 (L.EVar (["Basis"], "no_primary_key", _), L.EVar (["Basis"], "no_constraint", _)) =>
2247 let
2248 val x' = x ^ "_hidden_constraints"
2249 val (env', hidden_n) = E.pushCNamed env x' cstK NONE
2250 val hidden = (L'.CNamed hidden_n, loc)
2251 in
2252 (env', [(L'.SgiConAbs (x', hidden_n, cstK), loc)], (L'.CConcat (visible, hidden), loc))
2253 end
2254 | _ => (env, [], visible)
2248 2255
2249 val ct = tableOf () 2256 val ct = tableOf ()
2250 val ct = (L'.CApp (ct, c'), loc) 2257 val ct = (L'.CApp (ct, c'), loc)
2251 val ct = (L'.CApp (ct, (L'.CConcat (pkey, uniques), loc)), loc) 2258 val ct = (L'.CApp (ct, (L'.CConcat (pkey, uniques), loc)), loc)
2252 2259
2270 in 2277 in
2271 checkKind env c' ck (L'.KRecord (L'.KType, loc), loc); 2278 checkKind env c' ck (L'.KRecord (L'.KType, loc), loc);
2272 checkCon env' pe' pet pst; 2279 checkCon env' pe' pet pst;
2273 checkCon env' ce' cet cst; 2280 checkCon env' ce' cet cst;
2274 2281
2275 ([(L'.SgiConAbs (x', hidden_n, cstK), loc), 2282 (ds @ [(L'.SgiVal (x, n, ct), loc)], (env', denv, gs''' @ gs'' @ gs' @ gs))
2276 (L'.SgiVal (x, n, ct), loc)], (env', denv, gs''' @ gs'' @ gs' @ gs))
2277 end 2283 end
2278 2284
2279 | L.SgiStr (x, sgn) => 2285 | L.SgiStr (x, sgn) =>
2280 let 2286 let
2281 val (sgn', gs') = elabSgn (env, denv) sgn 2287 val (sgn', gs') = elabSgn (env, denv) sgn