proper NoSubsort CLASS_ERROR
authorhaftmann
Mon, 26 May 2008 17:55:35 +0200
changeset 26994 197af793312c
parent 26993 b952df8d505b
child 26995 2511a72dd73c
proper NoSubsort CLASS_ERROR
src/Pure/sorts.ML
--- a/src/Pure/sorts.ML	Mon May 26 17:55:34 2008 +0200
+++ b/src/Pure/sorts.ML	Mon May 26 17:55:35 2008 +0200
@@ -314,8 +314,9 @@
       "No class relation " ^ Pretty.string_of_classrel pp [c1, c2]
   | class_error pp (NoArity (a, c)) =
       "No type arity " ^ Pretty.string_of_arity pp (a, [], [c])
-  | class_error pp (NoSubsort (s1, s2)) =
-      Pretty.string_of_sort pp s1 ^ " is not a subsort of " ^ Pretty.string_of_sort pp s2;
+  | class_error pp (NoSubsort (S1, S2)) =
+     "Cannot derive subsort relation " ^ Pretty.string_of_sort pp S1
+       ^ " < " ^ Pretty.string_of_sort pp S2;
 
 exception CLASS_ERROR of class_error;
 
@@ -383,8 +384,7 @@
     fun weakens S1 S2 = S2 |> map (fn c2 =>
       (case S1 |> find_first (fn (_, c1) => class_le algebra (c1, c2)) of
         SOME d1 => weaken d1 c2
-      | NONE => error ("Cannot derive subsort relation " ^
-          Pretty.string_of_sort pp (map #2 S1) ^ " < " ^ Pretty.string_of_sort pp S2)));
+      | NONE => raise CLASS_ERROR (NoSubsort (map #2 S1, S2))));
 
     fun derive _ [] = []
       | derive (Type (a, Ts)) S =