comparison src/monoize.sml @ 1050:93315ac00394

More fun with cookies
author Adam Chlipala <adamc@hcoop.net>
date Thu, 26 Nov 2009 14:20:00 -0500
parents d73cf02427df
children 217eb87dde31
comparison
equal deleted inserted replaced
1049:c2317cfb99ec 1050:93315ac00394
1336 | L.ECApp ((L.EFfi ("Basis", "setCookie"), _), t) => 1336 | L.ECApp ((L.EFfi ("Basis", "setCookie"), _), t) =>
1337 let 1337 let
1338 val s = (L'.TFfi ("Basis", "string"), loc) 1338 val s = (L'.TFfi ("Basis", "string"), loc)
1339 val un = (L'.TRecord [], loc) 1339 val un = (L'.TRecord [], loc)
1340 val t = monoType env t 1340 val t = monoType env t
1341 val (e, fm) = urlifyExp env fm ((L'.ERel 1, loc), t) 1341 val rt = (L'.TRecord [("Value", t),
1342 in 1342 ("Expires", (L'.TOption (L'.TFfi ("Basis", "time"),
1343 ((L'.EAbs ("c", s, (L'.TFun (t, (L'.TFun (un, un), loc)), loc), 1343 loc), loc)),
1344 (L'.EAbs ("v", t, (L'.TFun (un, un), loc), 1344 ("Secure", (L'.TFfi ("Basis", "bool"), loc))], loc)
1345
1346 fun fd x = (L'.EField ((L'.ERel 1, loc), x), loc)
1347 val (e, fm) = urlifyExp env fm (fd "Value", t)
1348 in
1349 ((L'.EAbs ("c", s, (L'.TFun (rt, (L'.TFun (un, un), loc)), loc),
1350 (L'.EAbs ("r", rt, (L'.TFun (un, un), loc),
1345 (L'.EAbs ("_", un, un, 1351 (L'.EAbs ("_", un, un,
1346 (L'.EFfiApp ("Basis", "set_cookie", [(L'.EPrim (Prim.String 1352 (L'.EFfiApp ("Basis", "set_cookie", [(L'.EPrim (Prim.String
1347 (Settings.getUrlPrefix ())), 1353 (Settings.getUrlPrefix ())),
1348 loc), 1354 loc),
1349 (L'.ERel 2, loc), 1355 (L'.ERel 2, loc),
1350 e]), loc)), 1356 e,
1357 fd "Expires",
1358 fd "Secure"])
1359 , loc)), loc)), loc)), loc),
1360 fm)
1361 end
1362
1363 | L.ECApp ((L.EFfi ("Basis", "clearCookie"), _), t) =>
1364 let
1365 val s = (L'.TFfi ("Basis", "string"), loc)
1366 val un = (L'.TRecord [], loc)
1367 in
1368 ((L'.EAbs ("c", s, (L'.TFun (un, un), loc),
1369 (L'.EAbs ("_", un, un,
1370 (L'.EFfiApp ("Basis", "clear_cookie",
1371 [(L'.EPrim (Prim.String
1372 (Settings.getUrlPrefix ())),
1373 loc),
1374 (L'.ERel 1, loc)]),
1351 loc)), loc)), loc), 1375 loc)), loc)), loc),
1352 fm) 1376 fm)
1353 end 1377 end
1354 1378
1355 | L.ECApp ((L.EFfi ("Basis", "channel"), _), t) => 1379 | L.ECApp ((L.EFfi ("Basis", "channel"), _), t) =>
1356 ((L'.EAbs ("_", (L'.TRecord [], loc), (L'.TFfi ("Basis", "channel"), loc), 1380 ((L'.EAbs ("_", (L'.TRecord [], loc), (L'.TFfi ("Basis", "channel"), loc),
1357 (L'.EFfiApp ("Basis", "new_channel", [(L'.ERecord [], loc)]), loc)), loc), 1381 (L'.EFfiApp ("Basis", "new_channel", [(L'.ERecord [], loc)]), loc)), loc),
1358 fm) 1382 fm)