Mercurial > urweb
comparison src/rpcify.sml @ 955:01a4d936395a
tail example working
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Sep 2009 17:11:23 -0400 |
parents | 2a50da66ffd8 |
children | d80734855790 |
comparison
equal
deleted
inserted
replaced
954:2a50da66ffd8 | 955:01a4d936395a |
---|---|
257 val loc = #2 e | 257 val loc = #2 e |
258 val args = ListUtil.mapi | 258 val args = ListUtil.mapi |
259 (fn (i, _) => | 259 (fn (i, _) => |
260 (ERel (len - i - 1), loc)) | 260 (ERel (len - i - 1), loc)) |
261 ts | 261 ts |
262 val k = (EAbs ("x", ran, ran, (ERel 0, loc)), loc) | 262 val k = (EFfi ("Basis", "return"), loc) |
263 val trans = (CFfi ("Basis", "transaction"), loc) | |
264 val k = (ECApp (k, trans), loc) | |
265 val k = (ECApp (k, ran), loc) | |
266 val k = (EApp (k, (EFfi ("Basis", "transaction_monad"), | |
267 loc)), loc) | |
263 val re = (ETailCall (n, args, k, ran, ran), loc) | 268 val re = (ETailCall (n, args, k, ran, ran), loc) |
264 val (re, _) = foldr (fn (dom, (re, ran)) => | 269 val (re, _) = foldr (fn (dom, (re, ran)) => |
265 ((EAbs ("x", dom, ran, re), | 270 ((EAbs ("x", dom, ran, re), |
266 loc), | 271 loc), |
267 (TFun (dom, ran), loc))) | 272 (TFun (dom, ran), loc))) |
271 val be = ListUtil.foldli | 276 val be = ListUtil.foldli |
272 (fn (i, _, be) => | 277 (fn (i, _, be) => |
273 (EApp (be, (ERel (len - i), loc)), loc)) | 278 (EApp (be, (ERel (len - i), loc)), loc)) |
274 be ts | 279 be ts |
275 val ne = (EFfi ("Basis", "bind"), loc) | 280 val ne = (EFfi ("Basis", "bind"), loc) |
276 val trans = (CFfi ("Basis", "transaction"), loc) | |
277 val ne = (ECApp (ne, trans), loc) | 281 val ne = (ECApp (ne, trans), loc) |
278 val ne = (ECApp (ne, ran), loc) | 282 val ne = (ECApp (ne, ran), loc) |
279 val unit = (TRecord (CRecord ((KType, loc), []), | 283 val unit = (TRecord (CRecord ((KType, loc), []), |
280 loc), loc) | 284 loc), loc) |
281 val ne = (ECApp (ne, unit), loc) | 285 val ne = (ECApp (ne, unit), loc) |