diff lib/ur/basis.urs @ 704:70cbdcf5989b

UNIQUE constraints
author Adam Chlipala <adamc@hcoop.net>
date Tue, 07 Apr 2009 12:24:31 -0400
parents f963356b53fd
children e6706a1df013
line wrap: on
line diff
--- a/lib/ur/basis.urs	Sun Apr 05 16:17:32 2009 -0400
+++ b/lib/ur/basis.urs	Tue Apr 07 12:24:31 2009 -0400
@@ -124,6 +124,20 @@
 
 con sql_table :: {Type} -> Type
 
+(*** Constraints *)
+
+con sql_constraints :: {Unit} -> {Type} -> Type
+con sql_constraint :: {Type} -> Type
+
+val no_constraint : fs ::: {Type} -> sql_constraints [] fs
+val one_constraint : fs ::: {Type} -> name :: Name -> sql_constraint fs -> sql_constraints [name] fs
+val join_constraints : names1 ::: {Unit} -> names2 ::: {Unit} -> fs ::: {Type} -> [names1 ~ names2]
+    => sql_constraints names1 fs -> sql_constraints names2 fs
+       -> sql_constraints (names1 ++ names2) fs
+
+val unique : rest ::: {Type} -> unique :: {Type} -> [unique ~ rest] => sql_constraint (unique ++ rest)
+
+
 (*** Queries *)
 
 con sql_query :: {{Type}} -> {Type} -> Type