summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 17:19:12 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 17:19:12 -0400
commite7ee2c10c91252731665373f3fe01f43adfeed72 (patch)
treefcd5c44e383db901b132519ee9a953101bcb7b04
parentc166040950300c72de0b4091b837cd2d9bf76567 (diff)
Fix some type-class detection
-rw-r--r--lib/basis.urs1
-rw-r--r--src/elab_env.sml1
-rw-r--r--src/elaborate.sml1
-rw-r--r--src/monoize.sml9
4 files changed, 12 insertions, 0 deletions
diff --git a/lib/basis.urs b/lib/basis.urs
index a344b3ce..ca81c95f 100644
--- a/lib/basis.urs
+++ b/lib/basis.urs
@@ -56,6 +56,7 @@ val show_float : show float
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 --git a/src/elab_env.sml b/src/elab_env.sml
index 2732de13..6b762abd 100644
--- a/src/elab_env.sml
+++ b/src/elab_env.sml
@@ -419,6 +419,7 @@ fun class_pair_in (c, _) =
(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 --git a/src/elaborate.sml b/src/elaborate.sml
index 38c03f6e..b0f2d331 100644
--- a/src/elaborate.sml
+++ b/src/elaborate.sml
@@ -1398,6 +1398,7 @@ fun normClassConstraint envs (c, loc) =
in
((L'.CApp (f, x), loc), gs)
end
+ | L'.CUnif (_, _, _, ref (SOME c)) => normClassConstraint envs c
| _ => ((c, loc), [])
diff --git a/src/monoize.sml b/src/monoize.sml
index 79940842..0bdc1c70 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -844,6 +844,15 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
((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