comparison src/mono_util.sml @ 96:82aaa1c406d3

Mono optimizations (start with string concat and space eating)
author Adam Chlipala <adamc@hcoop.net>
date Thu, 03 Jul 2008 18:06:52 -0400
parents 40d146f467c5
children f0f59e918cac
comparison
equal deleted inserted replaced
95:274116d1a4cd 96:82aaa1c406d3
264 decl = fn ctx => fn d => fn () => S.Continue (decl ctx d, ()), 264 decl = fn ctx => fn d => fn () => S.Continue (decl ctx d, ()),
265 bind = bind} ctx ds () of 265 bind = bind} ctx ds () of
266 S.Continue (ds, ()) => ds 266 S.Continue (ds, ()) => ds
267 | S.Return _ => raise Fail "MonoUtil.File.mapB: Impossible" 267 | S.Return _ => raise Fail "MonoUtil.File.mapB: Impossible"
268 268
269 fun map {typ, exp, decl} e =
270 case mapfold {typ = fn c => fn () => S.Continue (typ c, ()),
271 exp = fn e => fn () => S.Continue (exp e, ()),
272 decl = fn d => fn () => S.Continue (decl d, ())} e () of
273 S.Return () => raise Fail "Mono_util.File.map"
274 | S.Continue (e, ()) => e
275
269 fun fold {typ, exp, decl} s d = 276 fun fold {typ, exp, decl} s d =
270 case mapfold {typ = fn c => fn s => S.Continue (c, typ (c, s)), 277 case mapfold {typ = fn c => fn s => S.Continue (c, typ (c, s)),
271 exp = fn e => fn s => S.Continue (e, exp (e, s)), 278 exp = fn e => fn s => S.Continue (e, exp (e, s)),
272 decl = fn d => fn s => S.Continue (d, decl (d, s))} d s of 279 decl = fn d => fn s => S.Continue (d, decl (d, s))} d s of
273 S.Continue (_, s) => s 280 S.Continue (_, s) => s