equal
deleted
inserted
replaced
1263 |> map_exec_purge |
1263 |> map_exec_purge |
1264 ((map_typs o Symtab.map_default (tyco, [])) (cons (serial (), vs_spec)) |
1264 ((map_typs o Symtab.map_default (tyco, [])) (cons (serial (), vs_spec)) |
1265 #> (map_cases o apfst) drop_outdated_cases) |
1265 #> (map_cases o apfst) drop_outdated_cases) |
1266 end; |
1266 end; |
1267 |
1267 |
1268 fun unoverload_const_typ thy (c, ty) = (Axclass.unoverload_const thy (c, ty), ty); |
|
1269 |
|
1270 structure Datatype_Plugin = Plugin(type T = string); |
1268 structure Datatype_Plugin = Plugin(type T = string); |
1271 |
1269 |
1272 val datatype_plugin = Plugin_Name.declare_setup @{binding datatype_code}; |
1270 val datatype_plugin = Plugin_Name.declare_setup @{binding datatype_code}; |
1273 |
1271 |
1274 fun datatype_interpretation f = |
1272 fun datatype_interpretation f = |
1280 |> f (tyco, fst (get_type thy tyco)) |
1278 |> f (tyco, fst (get_type thy tyco)) |
1281 |> Sign.restore_naming thy)); |
1279 |> Sign.restore_naming thy)); |
1282 |
1280 |
1283 fun add_datatype proto_constrs thy = |
1281 fun add_datatype proto_constrs thy = |
1284 let |
1282 let |
1285 val constrs = map (unoverload_const_typ thy) proto_constrs; |
1283 fun unoverload_const_typ (c, ty) = |
|
1284 (Axclass.unoverload_const thy (c, ty), ty); |
|
1285 val constrs = map unoverload_const_typ proto_constrs; |
1286 val (tyco, (vs, cos)) = constrset_of_consts thy constrs; |
1286 val (tyco, (vs, cos)) = constrset_of_consts thy constrs; |
1287 in |
1287 in |
1288 thy |
1288 thy |
1289 |> register_type (tyco, (vs, Constructors (cos, []))) |
1289 |> register_type (tyco, (vs, Constructors (cos, []))) |
1290 |> Named_Target.theory_map (Datatype_Plugin.data_default tyco) |
1290 |> Named_Target.theory_map (Datatype_Plugin.data_default tyco) |