comparison src/core_util.sml @ 177:5d030ee143e2

Case through corify
author Adam Chlipala <adamc@hcoop.net>
date Sat, 02 Aug 2008 11:15:32 -0400
parents 80192edca30d
children 3bbed533fbd2
comparison
equal deleted inserted replaced
176:33d4a8eea484 177:5d030ee143e2
225 and mfe' ctx (eAll as (e, loc)) = 225 and mfe' ctx (eAll as (e, loc)) =
226 case e of 226 case e of
227 EPrim _ => S.return2 eAll 227 EPrim _ => S.return2 eAll
228 | ERel _ => S.return2 eAll 228 | ERel _ => S.return2 eAll
229 | ENamed _ => S.return2 eAll 229 | ENamed _ => S.return2 eAll
230 | ECon (_, NONE) => S.return2 eAll
231 | ECon (n, SOME e) =>
232 S.map2 (mfe ctx e,
233 fn e' =>
234 (ECon (n, SOME e'), loc))
230 | EFfi _ => S.return2 eAll 235 | EFfi _ => S.return2 eAll
231 | EFfiApp (m, x, es) => 236 | EFfiApp (m, x, es) =>
232 S.map2 (ListUtil.mapfold (fn e => mfe ctx e) es, 237 S.map2 (ListUtil.mapfold (fn e => mfe ctx e) es,
233 fn es' => 238 fn es' =>
234 (EFfiApp (m, x, es'), loc)) 239 (EFfiApp (m, x, es'), loc))
294 (ECut (e', c', {field = field', rest = rest'}), loc))))) 299 (ECut (e', c', {field = field', rest = rest'}), loc)))))
295 | EFold k => 300 | EFold k =>
296 S.map2 (mfk k, 301 S.map2 (mfk k,
297 fn k' => 302 fn k' =>
298 (EFold k', loc)) 303 (EFold k', loc))
304
305 | ECase (e, pes, t) =>
306 S.bind2 (mfe ctx e,
307 fn e' =>
308 S.bind2 (ListUtil.mapfold (fn (p, e) =>
309 S.map2 (mfe ctx e,
310 fn e' => (p, e'))) pes,
311 fn pes' =>
312 S.map2 (mfc ctx t,
313 fn t' =>
314 (ECase (e', pes', t'), loc))))
299 315
300 | EWrite e => 316 | EWrite e =>
301 S.map2 (mfe ctx e, 317 S.map2 (mfe ctx e,
302 fn e' => 318 fn e' =>
303 (EWrite e', loc)) 319 (EWrite e', loc))