comparison src/monoize.sml @ 128:b04f7422c832

Monoizing (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:48:25 -0400
parents fd98dd10dce7
children b1cfe49ce692
comparison
equal deleted inserted replaced
127:4eb68ed31145 128:b04f7422c832
246 in 246 in
247 case d of 247 case d of
248 L.DCon _ => NONE 248 L.DCon _ => NONE
249 | L.DVal (x, n, t, e, s) => SOME (Env.pushENamed env x n t (SOME e) s, 249 | L.DVal (x, n, t, e, s) => SOME (Env.pushENamed env x n t (SOME e) s,
250 (L'.DVal (x, n, monoType env t, monoExp env e, s), loc)) 250 (L'.DVal (x, n, monoType env t, monoExp env e, s), loc))
251 | L.DValRec _ => raise Fail "Monoize DValRec" 251 | L.DValRec vis =>
252 let
253 val env = foldl (fn ((x, n, t, e, s), env) => Env.pushENamed env x n t NONE s) env vis
254 in
255 SOME (env,
256 (L'.DValRec (map (fn (x, n, t, e, s) => (x, n, monoType env t, monoExp env e, s)) vis), loc))
257 end
252 | L.DExport n => 258 | L.DExport n =>
253 let 259 let
254 val (_, t, _, s) = Env.lookupENamed env n 260 val (_, t, _, s) = Env.lookupENamed env n
255 261
256 fun unwind (t, _) = 262 fun unwind (t, _) =