aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-11-12 08:46:51 -0500
committerGravatar Ziv Scully <ziv@mit.edu>2015-11-12 08:46:51 -0500
commit6205c6660874af4147828e2610ca5c2feec834ad (patch)
tree3ae1ba40102d50b2e3c434a993e92d3d21d24987 /src/monoize.sml
parent7b14b2f01fd0218c0bbe0a5c4071fff190c91ce1 (diff)
parentdc8c8ed99b79e4f3c3c38f131dd7563148524591 (diff)
Merge.
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index bdd8f5c3..75851a48 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2306,22 +2306,45 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
_), _),
_), _),
_), _),
- _), _),
+ arg1), _),
_), _),
_) =>
let
val s = (L'.TFfi ("Basis", "string"), loc)
+
+ val default = strcat [str "(",
+ (L'.ERel 1, loc),
+ str " ",
+ (L'.ERel 2, loc),
+ str " ",
+ (L'.ERel 0, loc),
+ str ")"]
+
+ val body = case #1 arg1 of
+ L.CApp ((L.CFfi ("Basis", "option"), _), _) =>
+ (L'.ECase ((L'.ERel 2, loc),
+ [((L'.PPrim (Prim.String (Prim.Normal, "=")), loc),
+ strcat [str "((",
+ (L'.ERel 1, loc),
+ str " ",
+ (L'.ERel 2, loc),
+ str " ",
+ (L'.ERel 0, loc),
+ str ") OR ((",
+ (L'.ERel 1, loc),
+ str ") IS NULL AND (",
+ (L'.ERel 0, loc),
+ str ") IS NULL))"]),
+ ((L'.PWild, loc),
+ default)],
+ {disc = s,
+ result = s}), loc)
+ | _ => default
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 [str "(",
- (L'.ERel 1, loc),
- str " ",
- (L'.ERel 2, loc),
- str " ",
- (L'.ERel 0, loc),
- str ")"]), loc)), loc)), loc),
+ body), loc)), loc)), loc),
fm)
end
| L.EFfi ("Basis", "sql_and") => (str "AND", fm)