Mercurial > urweb
comparison src/elab_util.sml @ 12:d89477f07c1e
Fun with records
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 28 Mar 2008 17:34:57 -0400 |
parents | e97c6d335869 |
children | 6049e2193bf2 |
comparison
equal
deleted
inserted
replaced
11:e97c6d335869 | 12:d89477f07c1e |
---|---|
231 fn k' => | 231 fn k' => |
232 S.map2 (mfe (bind (ctx, RelC (x, k))) e, | 232 S.map2 (mfe (bind (ctx, RelC (x, k))) e, |
233 fn e' => | 233 fn e' => |
234 (ECAbs (expl, x, k', e'), loc))) | 234 (ECAbs (expl, x, k', e'), loc))) |
235 | 235 |
236 | ERecord xes => | |
237 S.map2 (ListUtil.mapfold (fn (x, e) => | |
238 S.bind2 (mfc ctx x, | |
239 fn x' => | |
240 S.map2 (mfe ctx e, | |
241 fn e' => | |
242 (x', e')))) | |
243 xes, | |
244 fn xes' => | |
245 (ERecord xes', loc)) | |
246 | EField (e, c, {field, rest}) => | |
247 S.bind2 (mfe ctx e, | |
248 fn e' => | |
249 S.bind2 (mfc ctx c, | |
250 fn c' => | |
251 S.bind2 (mfc ctx field, | |
252 fn field' => | |
253 S.map2 (mfc ctx rest, | |
254 fn rest' => | |
255 (EField (e', c', {field = field', rest = rest'}), loc))))) | |
256 | |
236 | EError => S.return2 eAll | 257 | EError => S.return2 eAll |
237 in | 258 in |
238 mfe | 259 mfe |
239 end | 260 end |
240 | 261 |