diff options
-rw-r--r-- | src/monoize.sml | 38 | ||||
-rw-r--r-- | tests/query.ur | 3 |
2 files changed, 37 insertions, 4 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index e908b162..7344c22f 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -684,6 +684,38 @@ fun monoExp (env, st, fm) (all as (e, loc)) = (L.ECApp ( (L.ECApp ( (L.ECApp ( + (L.ECApp ( + (L.ECApp ( + (L.EFfi ("Basis", "sql_binary"), _), + _), _), + _), _), + _), _), + _), _), + _), _), + _) => + let + val s = (L'.TFfi ("Basis", "string"), loc) + fun sc s = (L'.EPrim (Prim.String s), loc) + in + ((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), + (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), + (L'.EAbs ("e2", s, s, + strcat loc [sc "(", + (L'.ERel 1, loc), + sc " ", + (L'.ERel 2, loc), + sc " ", + (L'.ERel 0, loc), + sc ")"]), loc)), loc)), loc), + fm) + end + | L.EFfi ("Basis", "sql_and") => ((L'.EPrim (Prim.String "AND"), loc), fm) + | L.EFfi ("Basis", "sql_or") => ((L'.EPrim (Prim.String "OR"), loc), fm) + + | L.ECApp ( + (L.ECApp ( + (L.ECApp ( + (L.ECApp ( (L.EFfi ("Basis", "sql_comparison"), _), _), _), _), _), @@ -696,11 +728,13 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), (L'.EAbs ("e2", s, s, - strcat loc [(L'.ERel 1, loc), + strcat loc [sc "(", + (L'.ERel 1, loc), sc " ", (L'.ERel 2, loc), sc " ", - (L'.ERel 0, loc)]), loc)), loc)), loc), + (L'.ERel 0, loc), + sc ")"]), loc)), loc)), loc), fm) end diff --git a/tests/query.ur b/tests/query.ur index afe5fab8..334c3d41 100644 --- a/tests/query.ur +++ b/tests/query.ur @@ -3,8 +3,7 @@ table t2 : {A : float, D : int} datatype list a = Nil | Cons of a * list a -(*val q1 = (SELECT * FROM t1)*) -val q1 = (SELECT * FROM t1 WHERE t1.A = 0) +val q1 = (SELECT * FROM t1) val r1 : transaction (list {A : int, B : string, C : float, D : bool}) = query q1 |