src/Tools/Code/code_thingol.ML
changeset 32795 a0f38d8d633a
parent 32545 8631b421ffc3
child 32872 019201eb7e07
equal deleted inserted replaced
32794:7b100d30eb32 32795:a0f38d8d633a
   748 and translate_tyvar_sort thy (algbr as (proj_sort, _)) funcgr (v, sort) =
   748 and translate_tyvar_sort thy (algbr as (proj_sort, _)) funcgr (v, sort) =
   749   fold_map (ensure_class thy algbr funcgr) (proj_sort sort)
   749   fold_map (ensure_class thy algbr funcgr) (proj_sort sort)
   750   #>> (fn sort => (unprefix "'" v, sort))
   750   #>> (fn sort => (unprefix "'" v, sort))
   751 and translate_dicts thy (algbr as (proj_sort, algebra)) funcgr thm (ty, sort) =
   751 and translate_dicts thy (algbr as (proj_sort, algebra)) funcgr thm (ty, sort) =
   752   let
   752   let
   753     val pp = Syntax.pp_global thy;
       
   754     datatype typarg =
   753     datatype typarg =
   755         Global of (class * string) * typarg list list
   754         Global of (class * string) * typarg list list
   756       | Local of (class * class) list * (string * (int * sort));
   755       | Local of (class * class) list * (string * (int * sort));
   757     fun class_relation (Global ((_, tyco), yss), _) class =
   756     fun class_relation (Global ((_, tyco), yss), _) class =
   758           Global ((class, tyco), yss)
   757           Global ((class, tyco), yss)
   762       Global ((class, tyco), (map o map) fst yss);
   761       Global ((class, tyco), (map o map) fst yss);
   763     fun type_variable (TFree (v, sort)) =
   762     fun type_variable (TFree (v, sort)) =
   764       let
   763       let
   765         val sort' = proj_sort sort;
   764         val sort' = proj_sort sort;
   766       in map_index (fn (n, class) => (Local ([], (v, (n, sort'))), class)) sort' end;
   765       in map_index (fn (n, class) => (Local ([], (v, (n, sort'))), class)) sort' end;
   767     val typargs = Sorts.of_sort_derivation pp algebra
   766     val typargs = Sorts.of_sort_derivation algebra
   768       {class_relation = class_relation, type_constructor = type_constructor,
   767       {class_relation = class_relation, type_constructor = type_constructor,
   769        type_variable = type_variable} (ty, proj_sort sort)
   768        type_variable = type_variable} (ty, proj_sort sort)
   770       handle Sorts.CLASS_ERROR e => not_wellsorted thy thm ty sort e;
   769       handle Sorts.CLASS_ERROR e => not_wellsorted thy thm ty sort e;
   771     fun mk_dict (Global (inst, yss)) =
   770     fun mk_dict (Global (inst, yss)) =
   772           ensure_inst thy algbr funcgr inst
   771           ensure_inst thy algbr funcgr inst