summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-04 15:56:47 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-04 15:56:47 -0400
commitcd768be8105e43b8c8d0cf1578528a02f5341a95 (patch)
tree3464b0dbe1197e509f51d5f6181dda2804344e26 /src/monoize.sml
parentca7196c5dd362ccc6f19aaafef5b4252522e96a2 (diff)
sleep and better Scriptcheck
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index ea2ce751..d974e373 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -1002,6 +1002,23 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
t1), loc)), loc)), loc),
fm)
end
+ | L.EApp ((L.EApp ((L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "bind"), _), _), _), _), _), t2), _),
+ (L.EFfi ("Basis", "transaction_monad"), _)), _),
+ (L.EAbs (_, _, _,
+ (L.EFfiApp ("Basis", "sleep", [n]), _)), loc)) =>
+ let
+ val t2 = monoType env t2
+ val un = (L'.TRecord [], loc)
+ val mt2 = (L'.TFun (un, t2), loc)
+ val (n, fm) = monoExp (env, st, fm) n
+ in
+ ((L'.EAbs ("m2", (L'.TFun (un, mt2), loc), (L'.TFun (un, un), loc),
+ (L'.EAbs ("_", un, un,
+ (L'.ESleep (n, (L'.EApp ((L'.ERel 1, loc),
+ (L'.ERecord [], loc)), loc)),
+ loc)), loc)), loc),
+ fm)
+ end
| L.ECApp ((L.EFfi ("Basis", "source"), _), t) =>
let
@@ -1952,12 +1969,13 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
NONE => tagStart
| SOME extra => (L'.EStrcat (tagStart, extra), loc)
+ val xml = case extraInner of
+ NONE => xml
+ | SOME ei => (L.EFfiApp ("Basis", "strcat", [ei, xml]), loc)
+
fun normal () =
let
val (xml, fm) = monoExp (env, st, fm) xml
- val xml = case extraInner of
- NONE => xml
- | SOME ei => (L'.EStrcat (ei, xml), loc)
in
((L'.EStrcat ((L'.EStrcat (tagStart, (L'.EPrim (Prim.String ">"), loc)), loc),
(L'.EStrcat (xml,
@@ -2012,13 +2030,12 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
end
in
normal ("body",
- SOME (L'.EStrcat ((L'.EPrim (Prim.String " onload='"), loc),
- (L'.EStrcat ((L'.EFfiApp ("Basis", "get_settings",
- [(L'.ERecord [], loc)]), loc),
- (L'.EStrcat (onload,
- (L'.EPrim (Prim.String "'"),
- loc)), loc)), loc)), loc),
- SOME (L'.EFfiApp ("Basis", "get_script", [(L'.ERecord [], loc)]), loc))
+ SOME (L'.EFfiApp ("Basis", "maybe_onload",
+ [(L'.EStrcat ((L'.EFfiApp ("Basis", "get_settings",
+ [(L'.ERecord [], loc)]), loc),
+ onload), loc)]),
+ loc),
+ SOME (L.EFfiApp ("Basis", "get_script", [(L.ERecord [], loc)]), loc))
end
| "dyn" =>