comparison src/corify.sml @ 125:fd98dd10dce7

Corifying (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:23:04 -0400
parents 541282b81454
children 96bd3350e77d
comparison
equal deleted inserted replaced
124:541282b81454 125:fd98dd10dce7
382 else 382 else
383 x 383 x
384 in 384 in
385 ([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st) 385 ([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st)
386 end 386 end
387 | L.DValRec _ => raise Fail "Explify DValRec" 387 | L.DValRec vis =>
388 388 let
389 val (vis, st) = ListUtil.foldlMap
390 (fn ((x, n, t, e), st) =>
391 let
392 val (st, n) = St.bindVal st x n
393 val s =
394 if String.isPrefix "wrap_" x then
395 String.extract (x, 5, NONE)
396 else
397 x
398 in
399 ((x, n, corifyCon st t, corifyExp st e, s), st)
400 end)
401 st vis
402 in
403 ([(L'.DValRec vis, loc)], st)
404 end
389 | L.DSgn _ => ([], st) 405 | L.DSgn _ => ([], st)
390 406
391 | L.DStr (x, n, _, (L.StrFun (_, na, _, _, str), _)) => 407 | L.DStr (x, n, _, (L.StrFun (_, na, _, _, str), _)) =>
392 ([], St.bindFunctor st x n na str) 408 ([], St.bindFunctor st x n na str)
393 409