diff options
author | 2008-07-24 10:09:21 -0400 | |
---|---|---|
committer | 2008-07-24 10:09:21 -0400 | |
commit | 9e860c86c7d9c763deb9d51490a6766d9c72ed25 (patch) | |
tree | 7ba7c7cada5e7afa00c3e46879eb9974849286cf /src/elaborate.sml | |
parent | f19ae3bb20fa0c60e737606949b2bec6e3ae04f9 (diff) |
Record cut
Diffstat (limited to 'src/elaborate.sml')
-rw-r--r-- | src/elaborate.sml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/elaborate.sml b/src/elaborate.sml index b48a69f6..dd0b7187 100644 --- a/src/elaborate.sml +++ b/src/elaborate.sml @@ -895,6 +895,7 @@ fun typeof env (e, loc) = | L'.ERecord xes => (L'.TRecord (L'.CRecord (ktype, map (fn (x, _, t) => (x, t)) xes), loc), loc) | L'.EField (_, _, {field, ...}) => field + | L'.ECut (_, _, {rest, ...}) => (L'.TRecord rest, loc) | L'.EFold dom => foldType (dom, loc) | L'.EError => cerror @@ -1108,6 +1109,23 @@ fun elabExp (env, denv) (eAll as (e, loc)) = ((L'.EField (e', c', {field = ft, rest = rest}), loc), ft, gs1 @ gs2 @ gs3 @ gs4) end + | L.ECut (e, c) => + let + val (e', et, gs1) = elabExp (env, denv) e + val (c', ck, gs2) = elabCon (env, denv) c + + val ft = cunif (loc, ktype) + val rest = cunif (loc, ktype_record) + val first = (L'.CRecord (ktype, [(c', ft)]), loc) + + val gs3 = + checkCon (env, denv) e' et + (L'.TRecord (L'.CConcat (first, rest), loc), loc) + val gs4 = D.prove env denv (first, rest, loc) + in + ((L'.ECut (e', c', {field = ft, rest = rest}), loc), (L'.TRecord rest, loc), gs1 @ gs2 @ gs3 @ gs4) + end + | L.EFold => let val dom = kunif loc |