176 in case thy_of thy |
178 in case thy_of thy |
177 of SOME thy => Context.theory_name thy |
179 of SOME thy => Context.theory_name thy |
178 | NONE => error (errmsg x) end; |
180 | NONE => error (errmsg x) end; |
179 |
181 |
180 fun thyname_of_class thy = |
182 fun thyname_of_class thy = |
181 thyname_of thy (fn thy => member (op =) (Sign.all_classes thy)) |
183 thyname_of' thy (fn thy => member (op =) (Sign.all_classes thy)) |
182 (fn class => "thyname_of_class: no such class: " ^ quote class); |
184 (fn class => "thyname_of_class: no such class: " ^ quote class); |
183 |
185 |
184 fun thyname_of_tyco thy = |
186 fun thyname_of_tyco thy = thyname_of thy (Type.the_tags (Sign.tsig_of thy)); |
185 thyname_of thy Sign.declared_tyname |
|
186 (fn tyco => "thyname_of_tyco: no such type constructor: " ^ quote tyco); |
|
187 |
187 |
188 fun thyname_of_instance thy = |
188 fun thyname_of_instance thy = |
189 let |
189 let |
190 fun test_instance thy (class, tyco) = |
190 fun test_instance thy (class, tyco) = |
191 can (Sorts.mg_domain (Sign.classes_of thy) tyco) [class] |
191 can (Sorts.mg_domain (Sign.classes_of thy) tyco) [class] |
192 in thyname_of thy test_instance |
192 in thyname_of' thy test_instance |
193 (fn (class, tyco) => "thyname_of_instance: no such instance: " |
193 (fn (class, tyco) => "thyname_of_instance: no such instance: " |
194 ^ (quote o string_of_instance) (class, tyco)) |
194 ^ (quote o string_of_instance) (class, tyco)) |
195 end; |
195 end; |
196 |
196 |
197 fun thyname_of_const thy = |
197 fun thyname_of_const thy = thyname_of thy (Consts.the_tags (Sign.consts_of thy)); |
198 thyname_of thy Sign.declared_const |
|
199 (fn c => "thyname_of_const: no such constant: " ^ quote c); |
|
200 |
198 |
201 |
199 |
202 (* naming policies *) |
200 (* naming policies *) |
203 |
201 |
204 val purify_prefix = |
202 val purify_prefix = |