# HG changeset patch # User Adam Chlipala # Date 1225574352 14400 # Node ID 222cbc1da232458b5509ec458639247ae5b486c0 # Parent 1bd575eb2d1e3f1cd9f4f2f2fd6f5b5b10a00aa7 Fix some type-class detection diff -r 1bd575eb2d1e -r 222cbc1da232 lib/basis.urs --- a/lib/basis.urs Sat Nov 01 16:50:28 2008 -0400 +++ b/lib/basis.urs Sat Nov 01 17:19:12 2008 -0400 @@ -56,6 +56,7 @@ val show_string : show string val show_bool : show bool val show_time : show time +val mkShow : t ::: Type -> (t -> string) -> show t class read val read : t ::: Type -> read t -> string -> option t diff -r 1bd575eb2d1e -r 222cbc1da232 src/elab_env.sml --- a/src/elab_env.sml Sat Nov 01 16:50:28 2008 -0400 +++ b/src/elab_env.sml Sat Nov 01 17:19:12 2008 -0400 @@ -419,6 +419,7 @@ (case (class_name_in f, class_key_in x) of (SOME f, SOME x) => SOME (f, x) | _ => NONE) + | CUnif (_, _, _, ref (SOME c)) => class_pair_in c | _ => NONE fun resolveClass (env : env) c = diff -r 1bd575eb2d1e -r 222cbc1da232 src/elaborate.sml --- a/src/elaborate.sml Sat Nov 01 16:50:28 2008 -0400 +++ b/src/elaborate.sml Sat Nov 01 17:19:12 2008 -0400 @@ -1398,6 +1398,7 @@ in ((L'.CApp (f, x), loc), gs) end + | L'.CUnif (_, _, _, ref (SOME c)) => normClassConstraint envs c | _ => ((c, loc), []) diff -r 1bd575eb2d1e -r 222cbc1da232 src/monoize.sml --- a/src/monoize.sml Sat Nov 01 16:50:28 2008 -0400 +++ b/src/monoize.sml Sat Nov 01 17:19:12 2008 -0400 @@ -844,6 +844,15 @@ ((L'.EFfi ("Basis", "boolToString"), loc), fm) | L.EFfi ("Basis", "show_time") => ((L'.EFfi ("Basis", "timeToString"), loc), fm) + | L.ECApp ((L.EFfi ("Basis", "mkShow"), _), t) => + let + val t = monoType env t + val b = (L'.TFfi ("Basis", "string"), loc) + val dom = (L'.TFun (t, b), loc) + in + ((L'.EAbs ("f", dom, dom, + (L'.ERel 0, loc)), loc), fm) + end | L.ECApp ((L.EFfi ("Basis", "read"), _), t) => let