diff src/elaborate.sml @ 622:d64533157f40

Debug reverse-engineering unification
author Adam Chlipala <adamc@hcoop.net>
date Sat, 21 Feb 2009 16:11:56 -0500
parents 8998114760c1
children 588b9d16b00a
line wrap: on
line diff
--- a/src/elaborate.sml	Sat Feb 21 15:33:20 2009 -0500
+++ b/src/elaborate.sml	Sat Feb 21 16:11:56 2009 -0500
@@ -782,7 +782,7 @@
                                  val v' = case dom of
                                               (L'.KUnit, _) => (L'.CUnit, loc)
                                             | _ => cunif (loc, dom)
-                                 val gs2 = unifyCons (env, denv) v' (L'.CApp (f, v), loc)
+                                 val gs2 = unifyCons (env, denv) v (L'.CApp (f, v'), loc)
 
                                  val gs3 = unifyCons (env, denv) r (L'.CRecord (dom, [(x, v')]), loc)
                              in
@@ -792,10 +792,10 @@
                              let
                                  val r1 = cunif (loc, (L'.KRecord dom, loc))
                                  val r2 = cunif (loc, (L'.KRecord dom, loc))
-                                 val gs2 = unifyCons (env, denv) r (L'.CConcat (r1, r2), loc)
-
-                                 val gs3 = unfold (r1, (L'.CRecord (ran, [(x, v)]), loc))
-                                 val gs4 = unfold (r2, (L'.CRecord (ran, rest), loc))
+
+                                 val gs2 = unfold (r1, (L'.CRecord (ran, [(x, v)]), loc))
+                                 val gs3 = unfold (r2, (L'.CRecord (ran, rest), loc))
+                                 val gs4 = unifyCons (env, denv) r (L'.CConcat (r1, r2), loc)
                              in
                                  gs1 @ gs2 @ gs3 @ gs4
                              end
@@ -803,10 +803,10 @@
                              let
                                  val r1 = cunif (loc, (L'.KRecord dom, loc))
                                  val r2 = cunif (loc, (L'.KRecord dom, loc))
-                                 val gs2 = unifyCons (env, denv) r (L'.CConcat (r1, r2), loc)
-
-                                 val gs3 = unfold (r1, c1')
-                                 val gs4 = unfold (r2, c2')
+
+                                 val gs2 = unfold (r1, c1')
+                                 val gs3 = unfold (r2, c2')
+                                 val gs4 = unifyCons (env, denv) r (L'.CConcat (r1, r2), loc)
                              in
                                  gs1 @ gs2 @ gs3 @ gs4
                              end
@@ -815,7 +815,7 @@
              in
                  unfold (r, c)
              end
-             handle _ => raise ex
+             handle _ => (TextIO.print "Guess failure!\n"; raise ex)
      in
          case (#1 c1, #1 c2) of
              (L'.CApp ((L'.CApp ((L'.CMap (dom, ran), _), f), _), r), _) =>