diff src/elaborate.sml @ 564:803b2f3bb86b

Monad type class seems to be working
author Adam Chlipala <adamc@hcoop.net>
date Fri, 19 Dec 2008 10:27:58 -0500
parents 44958d74c43f
children 7c3c21eb5b4c
line wrap: on
line diff
--- a/src/elaborate.sml	Fri Dec 19 10:03:31 2008 -0500
+++ b/src/elaborate.sml	Fri Dec 19 10:27:58 2008 -0500
@@ -3548,7 +3548,15 @@
                                                   ("c1", p_con env c1),
                                                   ("c2", p_con env c2)];
                                         raise Fail "Unresolved constraint in top.ur"))
-                                | TypeClass _ => raise Fail "Unresolved type class constraint in top.ur") gs
+                                | TypeClass (env, c, r, loc) =>
+                                  let
+                                      val c = normClassKey env c
+                                  in
+                                      case E.resolveClass env c of
+                                          SOME e => r := SOME e
+                                        | NONE => expError env (Unresolvable (loc, c))
+                                  end) gs
+
         val () = subSgn (env', D.empty) topSgn' topSgn
 
         val (env', top_n) = E.pushStrNamed env' "Top" topSgn