Mercurial > urweb
comparison src/core_util.sml @ 21:067029c748e9
Beta reductions for expressions
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 08 Jun 2008 16:02:26 -0400 |
parents | 1ab48e37d0ef |
children | bfa2e9ae4df8 |
comparison
equal
deleted
inserted
replaced
20:1ab48e37d0ef | 21:067029c748e9 |
---|---|
264 mapfoldB {kind = fk, | 264 mapfoldB {kind = fk, |
265 con = fn () => fc, | 265 con = fn () => fc, |
266 exp = fn () => fe, | 266 exp = fn () => fe, |
267 bind = fn ((), _) => ()} () | 267 bind = fn ((), _) => ()} () |
268 | 268 |
269 fun mapB {kind, con, exp, bind} ctx e = | |
270 case mapfoldB {kind = fn k => fn () => S.Continue (kind k, ()), | |
271 con = fn ctx => fn c => fn () => S.Continue (con ctx c, ()), | |
272 exp = fn ctx => fn e => fn () => S.Continue (exp ctx e, ()), | |
273 bind = bind} ctx e () of | |
274 S.Continue (e, ()) => e | |
275 | S.Return _ => raise Fail "CoreUtil.Exp.mapB: Impossible" | |
276 | |
269 fun map {kind, con, exp} e = | 277 fun map {kind, con, exp} e = |
270 case mapfold {kind = fn k => fn () => S.Continue (kind k, ()), | 278 case mapfold {kind = fn k => fn () => S.Continue (kind k, ()), |
271 con = fn c => fn () => S.Continue (con c, ()), | 279 con = fn c => fn () => S.Continue (con c, ()), |
272 exp = fn e => fn () => S.Continue (exp e, ())} e () of | 280 exp = fn e => fn () => S.Continue (exp e, ())} e () of |
273 S.Return () => raise Fail "Core_util.Exp.map" | 281 S.Return () => raise Fail "Core_util.Exp.map" |