comparison src/core_util.sml @ 196:890a61991263

Lists all the way through
author Adam Chlipala <adamc@hcoop.net>
date Sat, 09 Aug 2008 16:48:32 -0400
parents 8a70e2919e86
children ab86aa858e6c
comparison
equal deleted inserted replaced
195:85b5f663bb86 196:890a61991263
569 fn k' => 569 fn k' =>
570 S.map2 (mfc ctx c, 570 S.map2 (mfc ctx c,
571 fn c' => 571 fn c' =>
572 (DCon (x, n, k', c'), loc))) 572 (DCon (x, n, k', c'), loc)))
573 | DDatatype (x, n, xs, xncs) => 573 | DDatatype (x, n, xs, xncs) =>
574 S.map2 (ListUtil.mapfold (fn (x, n, c) => 574 let
575 case c of 575 val k = (KType, loc)
576 NONE => S.return2 (x, n, c) 576 val k' = foldl (fn (_, k') => (KArrow (k, k'), loc)) k xs
577 | SOME c => 577 val ctx' = bind (ctx, NamedC (x, n, k', NONE))
578 S.map2 (mfc ctx c, 578 in
579 fn c' => (x, n, SOME c'))) xncs, 579 S.map2 (ListUtil.mapfold (fn (x, n, c) =>
580 fn xncs' => 580 case c of
581 (DDatatype (x, n, xs, xncs'), loc)) 581 NONE => S.return2 (x, n, c)
582 | SOME c =>
583 S.map2 (mfc ctx' c,
584 fn c' => (x, n, SOME c'))) xncs,
585 fn xncs' =>
586 (DDatatype (x, n, xs, xncs'), loc))
587 end
582 | DVal vi => 588 | DVal vi =>
583 S.map2 (mfvi ctx vi, 589 S.map2 (mfvi ctx vi,
584 fn vi' => 590 fn vi' =>
585 (DVal vi', loc)) 591 (DVal vi', loc))
586 | DValRec vis => 592 | DValRec vis =>