Mercurial > urweb
diff 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 |
line wrap: on
line diff
--- a/src/core_util.sml Sat Aug 09 12:50:49 2008 -0400 +++ b/src/core_util.sml Sat Aug 09 16:48:32 2008 -0400 @@ -571,14 +571,20 @@ fn c' => (DCon (x, n, k', c'), loc))) | DDatatype (x, n, xs, xncs) => - S.map2 (ListUtil.mapfold (fn (x, n, c) => - case c of - NONE => S.return2 (x, n, c) - | SOME c => - S.map2 (mfc ctx c, - fn c' => (x, n, SOME c'))) xncs, - fn xncs' => - (DDatatype (x, n, xs, xncs'), loc)) + let + val k = (KType, loc) + val k' = foldl (fn (_, k') => (KArrow (k, k'), loc)) k xs + val ctx' = bind (ctx, NamedC (x, n, k', NONE)) + in + S.map2 (ListUtil.mapfold (fn (x, n, c) => + case c of + NONE => S.return2 (x, n, c) + | SOME c => + S.map2 (mfc ctx' c, + fn c' => (x, n, SOME c'))) xncs, + fn xncs' => + (DDatatype (x, n, xs, xncs'), loc)) + end | DVal vi => S.map2 (mfvi ctx vi, fn vi' =>