comparison src/corify.sml @ 288:4260ad920c36

Converting string to int
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 11:33:13 -0400
parents 42dfb0d61cf0
children e976b187d73a
comparison
equal deleted inserted replaced
287:3ed7a7c7b060 288:4260ad920c36
605 in 605 in
606 ((x, n, co), st) 606 ((x, n, co), st)
607 end) st xncs 607 end) st xncs
608 608
609 val nxs = length xs - 1 609 val nxs = length xs - 1
610 val cBase = c
610 val c = ListUtil.foldli (fn (i, _, c) => (L'.CApp (c, (L'.CRel (nxs - i), loc)), loc)) c xs 611 val c = ListUtil.foldli (fn (i, _, c) => (L'.CApp (c, (L'.CRel (nxs - i), loc)), loc)) c xs
611 val k = (L'.KType, loc) 612 val k = (L'.KType, loc)
612 val k' = foldl (fn (_, k') => (L'.KArrow (k, k'), loc)) k xs 613 val k' = foldl (fn (_, k') => (L'.KArrow (k, k'), loc)) k xs
613 614
614 val cds = map (fn (x, n, co) => 615 val cds = map (fn (x, n, co) =>
621 val t = foldr (fn (x, t) => (L'.TCFun (x, k, t), loc)) t xs 622 val t = foldr (fn (x, t) => (L'.TCFun (x, k, t), loc)) t xs
622 in 623 in
623 (L'.DVal (x, n, t, e, x), loc) 624 (L'.DVal (x, n, t, e, x), loc)
624 end) xncs 625 end) xncs
625 in 626 in
626 ((L'.DCon (x, n, k', c), loc) :: cds, st) 627 ((L'.DCon (x, n, k', cBase), loc) :: cds, st)
627 end 628 end
628 | L.DVal (x, n, t, e) => 629 | L.DVal (x, n, t, e) =>
629 let 630 let
630 val (st, n) = St.bindVal st x n 631 val (st, n) = St.bindVal st x n
631 val s = 632 val s =