src/HOL/Tools/datatype_package.ML
changeset 18455 b293c1087f1d
parent 18451 5ff0244e25e8
child 18462 b67d423b5234
equal deleted inserted replaced
18454:6720b5010a57 18455:b293c1087f1d
    68   val datatype_info_err : theory -> string -> DatatypeAux.datatype_info
    68   val datatype_info_err : theory -> string -> DatatypeAux.datatype_info
    69   val is_datatype : theory -> string -> bool
    69   val is_datatype : theory -> string -> bool
    70   val get_datatype : theory -> string -> ((string * sort) list * string list) option
    70   val get_datatype : theory -> string -> ((string * sort) list * string list) option
    71   val get_datatype_cons : theory -> string * string -> typ list option
    71   val get_datatype_cons : theory -> string * string -> typ list option
    72   val get_case_const_data : theory -> string -> (string * int) list option
    72   val get_case_const_data : theory -> string -> (string * int) list option
    73   val get_all_datatype_cons : theory -> (string * string list) list
    73   val get_all_datatype_cons : theory -> (string * string) list
    74   val constrs_of : theory -> string -> term list option
    74   val constrs_of : theory -> string -> term list option
    75   val case_const_of : theory -> string -> term option
    75   val case_const_of : theory -> string -> term option
    76   val weak_case_congs_of : theory -> thm list
    76   val weak_case_congs_of : theory -> thm list
    77   val setup: (theory -> theory) list
    77   val setup: (theory -> theory) list
    78 end;
    78 end;
  1001     | SOME (_, {index, descr, ...}) =>
  1001     | SOME (_, {index, descr, ...}) =>
  1002         (SOME o map (apsnd length) o #3 o the o AList.lookup (op =) descr) index;
  1002         (SOME o map (apsnd length) o #3 o the o AList.lookup (op =) descr) index;
  1003 
  1003 
  1004 fun get_all_datatype_cons thy =
  1004 fun get_all_datatype_cons thy =
  1005   Symtab.fold (fn (dtco, _) => fold
  1005   Symtab.fold (fn (dtco, _) => fold
  1006     (fn co =>
  1006     (fn co => cons (co, dtco))
  1007       AList.default (op =) (co, []) #> AList.map_entry (op =) co (cons dtco))
  1007       ((snd o the oo get_datatype) thy dtco)) (get_datatypes thy) [];
  1008     ((snd o the oo get_datatype) thy dtco)) (get_datatypes thy) [];
  1008 
  1009 
  1009 
  1010 
  1010 
  1011 (** package setup **)
  1011 (** package setup **)
  1012 
  1012 
  1013 (* setup theory *)
  1013 (* setup theory *)