Mercurial > urweb
comparison src/elaborate.sml @ 80:321cb9805c8e
A little more conservative unification
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 29 Jun 2008 11:23:22 -0400 |
parents | 37847b504cc6 |
children | 60d97de1bbe8 |
comparison
equal
deleted
inserted
replaced
79:37847b504cc6 | 80:321cb9805c8e |
---|---|
533 and consEq env (c1, c2) = | 533 and consEq env (c1, c2) = |
534 (unifyCons env c1 c2; | 534 (unifyCons env c1 c2; |
535 true) | 535 true) |
536 handle CUnify _ => false | 536 handle CUnify _ => false |
537 | 537 |
538 and consNeq env (c1, c2) = | |
539 case (#1 (hnormCon env c1), #1 (hnormCon env c2)) of | |
540 (L'.CName x1, L'.CName x2) => x1 <> x2 | |
541 | _ => false | |
542 | |
538 and unifySummaries env (k, s1 : record_summary, s2 : record_summary) = | 543 and unifySummaries env (k, s1 : record_summary, s2 : record_summary) = |
539 let | 544 let |
540 (*val () = eprefaces "Summaries" [("#1", p_summary env s1), | 545 (*val () = eprefaces "Summaries" [("#1", p_summary env s1), |
541 ("#2", p_summary env s2)]*) | 546 ("#2", p_summary env s2)]*) |
542 | 547 |
561 in | 566 in |
562 em (ls1, ls2, []) | 567 em (ls1, ls2, []) |
563 end | 568 end |
564 | 569 |
565 val (fs1, fs2) = eatMatching (fn ((x1, c1), (x2, c2)) => | 570 val (fs1, fs2) = eatMatching (fn ((x1, c1), (x2, c2)) => |
566 consEq env (c1, c2) andalso consEq env (x1, x2)) | 571 not (consNeq env (x1, x2)) |
572 andalso consEq env (c1, c2) | |
573 andalso consEq env (x1, x2)) | |
567 (#fields s1, #fields s2) | 574 (#fields s1, #fields s2) |
568 (*val () = eprefaces "Summaries2" [("#1", p_summary env {fields = fs1, unifs = #unifs s1, others = #others s1}), | 575 (*val () = eprefaces "Summaries2" [("#1", p_summary env {fields = fs1, unifs = #unifs s1, others = #others s1}), |
569 ("#2", p_summary env {fields = fs2, unifs = #unifs s2, others = #others s2})]*) | 576 ("#2", p_summary env {fields = fs2, unifs = #unifs s2, others = #others s2})]*) |
570 val (unifs1, unifs2) = eatMatching (fn ((_, r1), (_, r2)) => r1 = r2) (#unifs s1, #unifs s2) | 577 val (unifs1, unifs2) = eatMatching (fn ((_, r1), (_, r2)) => r1 = r2) (#unifs s1, #unifs s2) |
571 val (others1, others2) = eatMatching (consEq env) (#others s1, #others s2) | 578 val (others1, others2) = eatMatching (consEq env) (#others s1, #others s2) |