summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-09 13:59:34 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-09 13:59:34 -0400
commitf181919900b537dca8d42760c4131da446a7e00d (patch)
treeff692444e26cba80b8c5b19ad5be21a85cbf563c /src
parenta8cf53e348e3b6d99a66a897f90de9aa523c9b40 (diff)
More flexible foreign keying
Diffstat (limited to 'src')
-rw-r--r--src/elab_err.sml4
-rw-r--r--src/elaborate.sml2
-rw-r--r--src/monoize.sml49
-rw-r--r--src/urweb.grm1
4 files changed, 37 insertions, 19 deletions
diff --git a/src/elab_err.sml b/src/elab_err.sml
index 172f7d37..ee8e1fd0 100644
--- a/src/elab_err.sml
+++ b/src/elab_err.sml
@@ -217,7 +217,7 @@ fun expError env err =
("Type", p_con env c)]) co)
| Unresolvable (loc, c) =>
(ErrorMsg.errorAt loc "Can't resolve type class instance";
- eprefaces' [("Class constraint", p_con env c),
+ eprefaces' [("Class constraint", p_con env c)(*,
("Class database", p_list (fn (c, rules) =>
box [P.p_con env c,
PD.string ":",
@@ -227,7 +227,7 @@ fun expError env err =
PD.string ":",
space,
P.p_con env c]) rules])
- (E.listClasses env))])
+ (E.listClasses env))*)])
| IllegalRec (x, e) =>
(ErrorMsg.errorAt (#2 e) "Illegal 'val rec' righthand side (must be a function abstraction)";
eprefaces' [("Variable", PD.string x),
diff --git a/src/elaborate.sml b/src/elaborate.sml
index 1323086c..6ee32da1 100644
--- a/src/elaborate.sml
+++ b/src/elaborate.sml
@@ -170,7 +170,7 @@
fun cunif (loc, k) =
let
val n = !count
- val s = if n <= 26 then
+ val s = if n < 26 then
str (chr (ord #"A" + n))
else
"U" ^ Int.toString (n - 26)
diff --git a/src/monoize.sml b/src/monoize.sml
index 84707b6e..bc44c550 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -155,6 +155,8 @@ fun monoType env =
(L'.TFfi ("Basis", "sql_constraints"), loc)
| L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_constraint"), _), _), _), _) =>
(L'.TFfi ("Basis", "string"), loc)
+ | L.CApp ((L.CApp ((L.CFfi ("Basis", "linkable"), _), _), _), _) =>
+ (L'.TRecord [], loc)
| L.CApp ((L.CApp ((L.CFfi ("Basis", "matching"), _), _), _), _) =>
let
val string = (L'.TFfi ("Basis", "string"), loc)
@@ -1226,6 +1228,13 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
fm)
end
+ | L.ECApp ((L.EFfi ("Basis", "linkable_same"), loc), _) =>
+ ((L'.ERecord [], loc), fm)
+ | L.ECApp ((L.EFfi ("Basis", "linkable_from_nullable"), loc), _) =>
+ ((L'.ERecord [], loc), fm)
+ | L.ECApp ((L.EFfi ("Basis", "linkable_to_nullable"), loc), _) =>
+ ((L'.ERecord [], loc), fm)
+
| L.EFfi ("Basis", "mat_nil") =>
let
val string = (L'.TFfi ("Basis", "string"), loc)
@@ -1239,7 +1248,9 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(L.ECApp (
(L.ECApp (
(L.ECApp (
- (L.EFfi ("Basis", "mat_cons"), _),
+ (L.ECApp (
+ (L.EFfi ("Basis", "mat_cons"), _),
+ _), _),
_), _),
_), _),
_), _),
@@ -1249,21 +1260,27 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
val string = (L'.TFfi ("Basis", "string"), loc)
val mat = (L'.TRecord [("1", string), ("2", string)], loc)
in
- ((L'.EAbs ("m", mat, mat,
- (L'.ECase ((L'.EField ((L'.ERel 0, loc), "1"), loc),
- [((L'.PPrim (Prim.String ""), loc),
- (L'.ERecord [("1", (L'.EPrim (Prim.String ("uw_" ^ nm1)), loc), string),
- ("2", (L'.EPrim (Prim.String ("uw_" ^ nm2)), loc), string)], loc)),
- ((L'.PWild, loc),
- (L'.ERecord [("1", (L'.EStrcat (
- (L'.EPrim (Prim.String ("uw_" ^ nm1 ^ ", ")), loc),
- (L'.EField ((L'.ERel 0, loc), "1"), loc)), loc), string),
- ("2", (L'.EStrcat (
- (L'.EPrim (Prim.String ("uw_" ^ nm2 ^ ", ")), loc),
- (L'.EField ((L'.ERel 0, loc), "2"), loc)), loc), string)],
- loc))],
- {disc = string,
- result = mat}), loc)), loc),
+ ((L'.EAbs ("_", (L'.TRecord [], loc), (L'.TFun (mat, mat), loc),
+ (L'.EAbs ("m", mat, mat,
+ (L'.ECase ((L'.EField ((L'.ERel 0, loc), "1"), loc),
+ [((L'.PPrim (Prim.String ""), loc),
+ (L'.ERecord [("1", (L'.EPrim (Prim.String ("uw_" ^ nm1)),
+ loc), string),
+ ("2", (L'.EPrim (Prim.String ("uw_" ^ nm2)),
+ loc), string)], loc)),
+ ((L'.PWild, loc),
+ (L'.ERecord [("1", (L'.EStrcat (
+ (L'.EPrim (Prim.String ("uw_" ^ nm1 ^ ", ")),
+ loc),
+ (L'.EField ((L'.ERel 0, loc), "1"), loc)),
+ loc), string),
+ ("2", (L'.EStrcat (
+ (L'.EPrim (Prim.String ("uw_" ^ nm2 ^ ", ")), loc),
+ (L'.EField ((L'.ERel 0, loc), "2"), loc)),
+ loc), string)],
+ loc))],
+ {disc = string,
+ result = mat}), loc)), loc)), loc),
fm)
end
diff --git a/src/urweb.grm b/src/urweb.grm
index 16a77150..50fb6cb3 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -523,6 +523,7 @@ cst : UNIQUE tnames (let
val e = (ECApp (e, nm2), loc)
val e = (EDisjointApp e, loc)
val e = (EDisjointApp e, loc)
+ val e = (EApp (e, (EWild, loc)), loc)
in
(EApp (e, mat), loc)
end)