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) |