comparison src/core_util.sml @ 707:d8217b4cb617

PRIMARY KEY
author Adam Chlipala <adamc@hcoop.net>
date Tue, 07 Apr 2009 16:14:31 -0400
parents e6706a1df013
children f152f215a02c
comparison
equal deleted inserted replaced
706:1fb318c17546 707:d8217b4cb617
931 S.map2 (ListUtil.mapfold (mfvi ctx) vis, 931 S.map2 (ListUtil.mapfold (mfvi ctx) vis,
932 fn vis' => 932 fn vis' =>
933 (DValRec vis', loc)) 933 (DValRec vis', loc))
934 end 934 end
935 | DExport _ => S.return2 dAll 935 | DExport _ => S.return2 dAll
936 | DTable (x, n, c, s, e, cc) => 936 | DTable (x, n, c, s, pe, pc, ce, cc) =>
937 S.bind2 (mfc ctx c, 937 S.bind2 (mfc ctx c,
938 fn c' => 938 fn c' =>
939 S.bind2 (mfe ctx e, 939 S.bind2 (mfe ctx pe,
940 fn e' => 940 fn pe' =>
941 S.map2 (mfc ctx cc, 941 S.bind2 (mfc ctx pc,
942 fn cc' => 942 fn pc' =>
943 (DTable (x, n, c', s, e', cc'), loc)))) 943 S.bind2 (mfe ctx ce,
944 fn ce' =>
945 S.map2 (mfc ctx cc,
946 fn cc' =>
947 (DTable (x, n, c', s, pe', pc', ce', cc'), loc))))))
944 | DSequence _ => S.return2 dAll 948 | DSequence _ => S.return2 dAll
945 | DDatabase _ => S.return2 dAll 949 | DDatabase _ => S.return2 dAll
946 | DCookie (x, n, c, s) => 950 | DCookie (x, n, c, s) =>
947 S.map2 (mfc ctx c, 951 S.map2 (mfc ctx c,
948 fn c' => 952 fn c' =>
1060 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s)) 1064 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s))
1061 | DValRec vis => 1065 | DValRec vis =>
1062 foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s))) 1066 foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s)))
1063 ctx vis 1067 ctx vis
1064 | DExport _ => ctx 1068 | DExport _ => ctx
1065 | DTable (x, n, c, s, _, cc) => 1069 | DTable (x, n, c, s, _, pc, _, cc) =>
1066 let 1070 let
1067 val loc = #2 d' 1071 val loc = #2 d'
1068 val ct = (CFfi ("Basis", "sql_table"), loc) 1072 val ct = (CFfi ("Basis", "sql_table"), loc)
1069 val ct = (CApp (ct, c), loc) 1073 val ct = (CApp (ct, (CConcat (pc, cc), loc)), loc)
1070 val ct = (CApp (ct, cc), loc) 1074 val ct = (CApp (ct, cc), loc)
1071 in 1075 in
1072 bind (ctx, NamedE (x, n, ct, NONE, s)) 1076 bind (ctx, NamedE (x, n, ct, NONE, s))
1073 end 1077 end
1074 | DSequence (x, n, s) => 1078 | DSequence (x, n, s) =>
1139 foldl (fn ((_, n', _), m) => Int.max (n', m)) 1143 foldl (fn ((_, n', _), m) => Int.max (n', m))
1140 (Int.max (n, count)) ns 1144 (Int.max (n, count)) ns
1141 | DVal (_, n, _, _, _) => Int.max (n, count) 1145 | DVal (_, n, _, _, _) => Int.max (n, count)
1142 | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis 1146 | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis
1143 | DExport _ => count 1147 | DExport _ => count
1144 | DTable (_, n, _, _, _, _) => Int.max (n, count) 1148 | DTable (_, n, _, _, _, _, _, _) => Int.max (n, count)
1145 | DSequence (_, n, _) => Int.max (n, count) 1149 | DSequence (_, n, _) => Int.max (n, count)
1146 | DDatabase _ => count 1150 | DDatabase _ => count
1147 | DCookie (_, n, _, _) => Int.max (n, count)) 0 1151 | DCookie (_, n, _, _) => Int.max (n, count)) 0
1148 1152
1149 end 1153 end