Mercurial > urweb
comparison src/mono_reduce.sml @ 462:21bb5bbba2e9
Setting a cookie
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 06 Nov 2008 11:29:16 -0500 |
parents | 1a4fa157fedd |
children | bb27c7efcd90 |
comparison
equal
deleted
inserted
replaced
461:5c9606deacb6 | 462:21bb5bbba2e9 |
---|---|
48 | ENamed _ => false | 48 | ENamed _ => false |
49 | ECon (_, _, eo) => (case eo of NONE => false | SOME e => impure e) | 49 | ECon (_, _, eo) => (case eo of NONE => false | SOME e => impure e) |
50 | ENone _ => false | 50 | ENone _ => false |
51 | ESome (_, e) => impure e | 51 | ESome (_, e) => impure e |
52 | EFfi _ => false | 52 | EFfi _ => false |
53 | EFfiApp ("Basis", "set_cookie", _) => true | |
53 | EFfiApp _ => false | 54 | EFfiApp _ => false |
54 | EApp ((EFfi _, _), _) => false | 55 | EApp ((EFfi _, _), _) => false |
55 | EApp _ => true | 56 | EApp _ => true |
56 | 57 |
57 | EUnop (_, e) => impure e | 58 | EUnop (_, e) => impure e |
229 | ECon (_, _, NONE) => [] | 230 | ECon (_, _, NONE) => [] |
230 | ECon (_, _, SOME e) => summarize d e | 231 | ECon (_, _, SOME e) => summarize d e |
231 | ENone _ => [] | 232 | ENone _ => [] |
232 | ESome (_, e) => summarize d e | 233 | ESome (_, e) => summarize d e |
233 | EFfi _ => [] | 234 | EFfi _ => [] |
235 | EFfiApp ("Basis", "set_cookie", _) => [Unsure] | |
234 | EFfiApp (_, _, es) => List.concat (map (summarize d) es) | 236 | EFfiApp (_, _, es) => List.concat (map (summarize d) es) |
235 | EApp ((EFfi _, _), e) => summarize d e | 237 | EApp ((EFfi _, _), e) => summarize d e |
236 | EApp _ => [Unsure] | 238 | EApp _ => [Unsure] |
237 | EAbs _ => [] | 239 | EAbs _ => [] |
238 | 240 |
345 end | 347 end |
346 | EApp ((ELet (x, t, e, b), loc), e') => | 348 | EApp ((ELet (x, t, e, b), loc), e') => |
347 #1 (reduceExp env (ELet (x, t, e, | 349 #1 (reduceExp env (ELet (x, t, e, |
348 (EApp (b, liftExpInExp 0 e'), loc)), loc)) | 350 (EApp (b, liftExpInExp 0 e'), loc)), loc)) |
349 | 351 |
350 | ELet (x, t, e, (EAbs (x', t' as (TRecord [], _), ran, e'), loc)) => | 352 | ELet (x, t, e', (EAbs (x', t' as (TRecord [], _), ran, e''), loc)) => |
351 EAbs (x', t', ran, (ELet (x, t, liftExpInExp 0 e, swapExpVars 0 e'), loc)) | 353 if impure e' then |
354 e | |
355 else | |
356 EAbs (x', t', ran, (ELet (x, t, liftExpInExp 0 e', swapExpVars 0 e''), loc)) | |
352 | 357 |
353 | ELet (x, t, e', b) => | 358 | ELet (x, t, e', b) => |
354 let | 359 let |
355 fun doSub () = #1 (reduceExp env (subExpInExp (0, e') b)) | 360 fun doSub () = |
361 #1 (reduceExp env (subExpInExp (0, e') b)) | |
356 | 362 |
357 fun trySub () = | 363 fun trySub () = |
358 case t of | 364 case t of |
359 (TFfi ("Basis", "string"), _) => doSub () | 365 (TFfi ("Basis", "string"), _) => doSub () |
360 | _ => | 366 | _ => |