Mercurial > urweb
comparison src/core_util.sml @ 109:813e5a52063d
Remove closure conversion in favor of zany fun with modules, which also replaces 'page'
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 13 Jul 2008 10:17:06 -0400 |
parents | 5f04adf47f48 |
children | 3739af9e727a |
comparison
equal
deleted
inserted
replaced
108:f59553dc1b6a | 109:813e5a52063d |
---|---|
201 | 201 |
202 datatype binder = | 202 datatype binder = |
203 RelC of string * kind | 203 RelC of string * kind |
204 | NamedC of string * int * kind * con option | 204 | NamedC of string * int * kind * con option |
205 | RelE of string * con | 205 | RelE of string * con |
206 | NamedE of string * int * con * exp option | 206 | NamedE of string * int * con * exp option * string |
207 | 207 |
208 fun mapfoldB {kind = fk, con = fc, exp = fe, bind} = | 208 fun mapfoldB {kind = fk, con = fc, exp = fe, bind} = |
209 let | 209 let |
210 val mfk = Kind.mapfold fk | 210 val mfk = Kind.mapfold fk |
211 | 211 |
373 S.bind2 (mfk k, | 373 S.bind2 (mfk k, |
374 fn k' => | 374 fn k' => |
375 S.map2 (mfc ctx c, | 375 S.map2 (mfc ctx c, |
376 fn c' => | 376 fn c' => |
377 (DCon (x, n, k', c'), loc))) | 377 (DCon (x, n, k', c'), loc))) |
378 | DVal (x, n, t, e) => | 378 | DVal (x, n, t, e, s) => |
379 S.bind2 (mfc ctx t, | 379 S.bind2 (mfc ctx t, |
380 fn t' => | 380 fn t' => |
381 S.map2 (mfe ctx e, | 381 S.map2 (mfe ctx e, |
382 fn e' => | 382 fn e' => |
383 (DVal (x, n, t', e'), loc))) | 383 (DVal (x, n, t', e', s), loc))) |
384 | DPage (c, e) => | 384 | DExport _ => S.return2 dAll |
385 S.bind2 (mfc ctx c, | |
386 fn c' => | |
387 S.map2 (mfe ctx e, | |
388 fn e' => | |
389 (DPage (c', e'), loc))) | |
390 in | 385 in |
391 mfd | 386 mfd |
392 end | 387 end |
393 | 388 |
394 fun mapfold {kind = fk, con = fc, exp = fe, decl = fd} = | 389 fun mapfold {kind = fk, con = fc, exp = fe, decl = fd} = |
424 fn d' => | 419 fn d' => |
425 let | 420 let |
426 val ctx' = | 421 val ctx' = |
427 case #1 d' of | 422 case #1 d' of |
428 DCon (x, n, k, c) => bind (ctx, NamedC (x, n, k, SOME c)) | 423 DCon (x, n, k, c) => bind (ctx, NamedC (x, n, k, SOME c)) |
429 | DVal (x, n, t, e) => bind (ctx, NamedE (x, n, t, SOME e)) | 424 | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s)) |
430 | DPage _ => ctx | 425 | DExport _ => ctx |
431 in | 426 in |
432 S.map2 (mff ctx' ds', | 427 S.map2 (mff ctx' ds', |
433 fn ds' => | 428 fn ds' => |
434 d' :: ds') | 429 d' :: ds') |
435 end) | 430 end) |