comparison src/elab_util.sml @ 1732:4a03aa3251cb

Initial support for reusing elaboration results
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 Apr 2012 13:17:31 -0400
parents 6c00d8af6239
children d28adceef22a
comparison
equal deleted inserted replaced
1731:27e731a65934 1732:4a03aa3251cb
1178 decl = fn ctx => fn s => fn () => S.Continue (decl ctx s, ()), 1178 decl = fn ctx => fn s => fn () => S.Continue (decl ctx s, ()),
1179 bind = bind} ctx s () of 1179 bind = bind} ctx s () of
1180 S.Continue (s, ()) => s 1180 S.Continue (s, ()) => s
1181 | S.Return _ => raise Fail "ElabUtil.Decl.mapB: Impossible" 1181 | S.Return _ => raise Fail "ElabUtil.Decl.mapB: Impossible"
1182 1182
1183 fun fold {kind, con, exp, sgn_item, sgn, str, decl} (st : 'a) d : 'a =
1184 case mapfold {kind = fn k => fn st => S.Continue (k, kind (k, st)),
1185 con = fn c => fn st => S.Continue (c, con (c, st)),
1186 exp = fn e => fn st => S.Continue (e, exp (e, st)),
1187 sgn_item = fn sgi => fn st => S.Continue (sgi, sgn_item (sgi, st)),
1188 sgn = fn s => fn st => S.Continue (s, sgn (s, st)),
1189 str = fn str' => fn st => S.Continue (str', str (str', st)),
1190 decl = fn d => fn st => S.Continue (d, decl (d, st))} d st of
1191 S.Continue (_, st) => st
1192 | S.Return _ => raise Fail "ElabUtil.Decl.fold: Impossible"
1193
1183 end 1194 end
1184 1195
1185 structure File = struct 1196 structure File = struct
1186 1197
1187 fun maxName ds = foldl (fn (d, count) => Int.max (maxNameDecl d, count)) 0 ds 1198 fun maxName ds = foldl (fn (d, count) => Int.max (maxNameDecl d, count)) 0 ds