comparison src/core_util.sml @ 704:70cbdcf5989b

UNIQUE constraints
author Adam Chlipala <adamc@hcoop.net>
date Tue, 07 Apr 2009 12:24:31 -0400
parents 230654093b51
children e6706a1df013
comparison
equal deleted inserted replaced
703:a5d8b470d7ca 704:70cbdcf5989b
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) => 936 | DTable (x, n, c, s, e) =>
937 S.map2 (mfc ctx c, 937 S.bind2 (mfc ctx c,
938 fn c' => 938 fn c' =>
939 (DTable (x, n, c', s), loc)) 939 S.map2 (mfe ctx e,
940 fn e' =>
941 (DTable (x, n, c', s, e'), loc)))
940 | DSequence _ => S.return2 dAll 942 | DSequence _ => S.return2 dAll
941 | DDatabase _ => S.return2 dAll 943 | DDatabase _ => S.return2 dAll
942 | DCookie (x, n, c, s) => 944 | DCookie (x, n, c, s) =>
943 S.map2 (mfc ctx c, 945 S.map2 (mfc ctx c,
944 fn c' => 946 fn c' =>
1056 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s)) 1058 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s))
1057 | DValRec vis => 1059 | DValRec vis =>
1058 foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s))) 1060 foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s)))
1059 ctx vis 1061 ctx vis
1060 | DExport _ => ctx 1062 | DExport _ => ctx
1061 | DTable (x, n, c, s) => 1063 | DTable (x, n, c, s, _) =>
1062 let 1064 let
1063 val t = (CApp ((CFfi ("Basis", "sql_table"), #2 d'), c), #2 d') 1065 val t = (CApp ((CFfi ("Basis", "sql_table"), #2 d'), c), #2 d')
1064 in 1066 in
1065 bind (ctx, NamedE (x, n, t, NONE, s)) 1067 bind (ctx, NamedE (x, n, t, NONE, s))
1066 end 1068 end
1132 foldl (fn ((_, n', _), m) => Int.max (n', m)) 1134 foldl (fn ((_, n', _), m) => Int.max (n', m))
1133 (Int.max (n, count)) ns 1135 (Int.max (n, count)) ns
1134 | DVal (_, n, _, _, _) => Int.max (n, count) 1136 | DVal (_, n, _, _, _) => Int.max (n, count)
1135 | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis 1137 | DValRec vis => foldl (fn ((_, n, _, _, _), count) => Int.max (n, count)) count vis
1136 | DExport _ => count 1138 | DExport _ => count
1137 | DTable (_, n, _, _) => Int.max (n, count) 1139 | DTable (_, n, _, _, _) => Int.max (n, count)
1138 | DSequence (_, n, _) => Int.max (n, count) 1140 | DSequence (_, n, _) => Int.max (n, count)
1139 | DDatabase _ => count 1141 | DDatabase _ => count
1140 | DCookie (_, n, _, _) => Int.max (n, count)) 0 1142 | DCookie (_, n, _, _) => Int.max (n, count)) 0
1141 1143
1142 end 1144 end