src/HOL/Tools/functor.ML
changeset 80634 a90ab1ea6458
parent 78095 bc42c074e58f
child 81513 d11ed1bf0ad2
equal deleted inserted replaced
80633:276b07a1b5f5 80634:a90ab1ea6458
   207   let
   207   let
   208     fun bad_typ () = error ("Bad mapper type: " ^ Syntax.string_of_typ ctxt T);
   208     fun bad_typ () = error ("Bad mapper type: " ^ Syntax.string_of_typ ctxt T);
   209     val (Ts, T1, T2) = split_mapper_typ tyco T
   209     val (Ts, T1, T2) = split_mapper_typ tyco T
   210       handle List.Empty => bad_typ ();
   210       handle List.Empty => bad_typ ();
   211     val _ =
   211     val _ =
   212       apply2 ((fn tyco' => if tyco' = tyco then () else bad_typ ()) o fst o dest_Type) (T1, T2)
   212       apply2 ((fn tyco' => if tyco' = tyco then () else bad_typ ()) o dest_Type_name) (T1, T2)
   213         handle TYPE _ => bad_typ ();
   213         handle TYPE _ => bad_typ ();
   214     val (vs1, vs2) =
   214     val (vs1, vs2) =
   215       apply2 (map dest_TFree o snd o dest_Type) (T1, T2)
   215       apply2 (map dest_TFree o dest_Type_args) (T1, T2)
   216         handle TYPE _ => bad_typ ();
   216         handle TYPE _ => bad_typ ();
   217     val _ = if has_duplicates (eq_fst (op =)) (vs1 @ vs2)
   217     val _ = if has_duplicates (eq_fst (op =)) (vs1 @ vs2)
   218       then bad_typ () else ();
   218       then bad_typ () else ();
   219     fun check_variance_pair (var1 as (_, sort1), var2 as (_, sort2)) =
   219     fun check_variance_pair (var1 as (_, sort1), var2 as (_, sort2)) =
   220       let
   220       let