src/HOL/Tools/Datatype/datatype_aux.ML
changeset 40722 441260986b63
parent 39557 fe5722fce758
child 40929 7ff03a5e044f
equal deleted inserted replaced
40721:e5089e903e39 40722:441260986b63
   322       (case Symtab.lookup dt_info tname of
   322       (case Symtab.lookup dt_info tname of
   323          NONE => typ_error T (tname ^ " is not a datatype - can't use it in\
   323          NONE => typ_error T (tname ^ " is not a datatype - can't use it in\
   324            \ nested recursion")
   324            \ nested recursion")
   325        | (SOME {index, descr, ...}) =>
   325        | (SOME {index, descr, ...}) =>
   326            let val (_, vars, _) = (the o AList.lookup (op =) descr) index;
   326            let val (_, vars, _) = (the o AList.lookup (op =) descr) index;
   327                val subst = ((map dest_DtTFree vars) ~~ dts) handle Library.UnequalLengths =>
   327                val subst = ((map dest_DtTFree vars) ~~ dts) handle ListPair.UnequalLengths =>
   328                  typ_error T ("Type constructor " ^ tname ^ " used with wrong\
   328                  typ_error T ("Type constructor " ^ tname ^ " used with wrong\
   329                   \ number of arguments")
   329                   \ number of arguments")
   330            in (i + index, map (fn (j, (tn, args, cs)) => (i + j,
   330            in (i + index, map (fn (j, (tn, args, cs)) => (i + j,
   331              (tn, map (subst_DtTFree i subst) args,
   331              (tn, map (subst_DtTFree i subst) args,
   332               map (apsnd (map (subst_DtTFree i subst))) cs))) descr)
   332               map (apsnd (map (subst_DtTFree i subst))) cs))) descr)