comparison src/elab_util.sml @ 171:c7a6e6dbc318

Elaborating some basic pattern matching
author Adam Chlipala <adamc@hcoop.net>
date Thu, 31 Jul 2008 10:06:27 -0400
parents 06a98129b23f
children d11754ffe252
comparison
equal deleted inserted replaced
170:a158f8c5aa55 171:c7a6e6dbc318
305 305
306 | EFold k => 306 | EFold k =>
307 S.map2 (mfk k, 307 S.map2 (mfk k,
308 fn k' => 308 fn k' =>
309 (EFold k', loc)) 309 (EFold k', loc))
310
311 | ECase (e, pes, t) =>
312 S.bind2 (mfe ctx e,
313 fn e' =>
314 S.bind2 (ListUtil.mapfold (fn (p, e) =>
315 S.map2 (mfe ctx e,
316 fn e' => (p, e'))) pes,
317 fn pes' =>
318 S.map2 (mfc ctx t,
319 fn t' =>
320 (ECase (e', pes', t'), loc))))
310 321
311 | EError => S.return2 eAll 322 | EError => S.return2 eAll
312 in 323 in
313 mfe 324 mfe
314 end 325 end