145 |
145 |
146 fun pretty_const (c, ty) = Pretty.block |
146 fun pretty_const (c, ty) = Pretty.block |
147 [Pretty.str c, Pretty.str " ::", Pretty.brk 1, prt_typ ty]; |
147 [Pretty.str c, Pretty.str " ::", Pretty.brk 1, prt_typ ty]; |
148 |
148 |
149 val {self = _, tsig, const_tab, syn = _, path, spaces, data} = Sign.rep_sg sg; |
149 val {self = _, tsig, const_tab, syn = _, path, spaces, data} = Sign.rep_sg sg; |
150 val spaces' = sort (fn ((k1, _), (k2, _)) => k1 < k2) spaces; |
150 val spaces' = sort_wrt fst spaces; |
151 val {classes, classrel, default, tycons, abbrs, arities} = |
151 val {classes, classrel, default, tycons, abbrs, arities} = |
152 Type.rep_tsig tsig; |
152 Type.rep_tsig tsig; |
153 val consts = sort_wrt fst (map (apfst ext_const) (Symtab.dest const_tab)); |
153 val consts = sort_wrt fst (map (apfst ext_const) (Symtab.dest const_tab)); |
154 in |
154 in |
155 Pretty.writeln (Pretty.strs ("stamps:" :: Sign.stamp_names_of sg)); |
155 Pretty.writeln (Pretty.strs ("stamps:" :: Sign.stamp_names_of sg)); |
217 |
217 |
218 fun add_varsT (Type (_, Ts), env) = foldr add_varsT (Ts, env) |
218 fun add_varsT (Type (_, Ts), env) = foldr add_varsT (Ts, env) |
219 | add_varsT (TFree (x, S), env) = ins_entry (S, (x, ~1)) env |
219 | add_varsT (TFree (x, S), env) = ins_entry (S, (x, ~1)) env |
220 | add_varsT (TVar (xi, S), env) = ins_entry (S, xi) env; |
220 | add_varsT (TVar (xi, S), env) = ins_entry (S, xi) env; |
221 |
221 |
222 fun less_idx ((x, i):indexname, (y, j):indexname) = |
222 fun sort_idxs vs = map (apsnd (sort (prod_ord string_ord int_ord))) vs; |
223 x < y orelse x = y andalso i < j; |
223 fun sort_cnsts cs = map (apsnd (sort_wrt fst)) cs; |
224 fun sort_idxs l = map (apsnd (sort less_idx)) l; |
|
225 fun sort_cnsts l = map (apsnd (sort_wrt fst)) l; |
|
226 |
224 |
227 |
225 |
228 (* prepare atoms *) |
226 (* prepare atoms *) |
229 |
227 |
230 fun consts_of t = sort_cnsts (add_consts (t, [])); |
228 fun consts_of t = sort_cnsts (add_consts (t, [])); |