src/Tools/Code/code_scala.ML
changeset 34308 394fc3cce915
parent 34294 19c1fd52d6c9
child 34888 460ec1a99aa2
equal deleted inserted replaced
34307:9074aa7d06e0 34308:394fc3cce915
    58           (case Code_Thingol.unfold_const_app t0
    58           (case Code_Thingol.unfold_const_app t0
    59            of SOME (c_ts as ((c, _), _)) => if is_none (syntax_const c)
    59            of SOME (c_ts as ((c, _), _)) => if is_none (syntax_const c)
    60                 then print_case tyvars thm vars fxy cases
    60                 then print_case tyvars thm vars fxy cases
    61                 else print_app tyvars is_pat thm vars fxy c_ts
    61                 else print_app tyvars is_pat thm vars fxy c_ts
    62             | NONE => print_case tyvars thm vars fxy cases)
    62             | NONE => print_case tyvars thm vars fxy cases)
    63     and print_app tyvars is_pat thm vars fxy (app as ((c, ((tys, _), _)), ts)) =
    63     and print_app tyvars is_pat thm vars fxy (app as ((c, ((tys, _), tys_args)), ts)) =
    64       let
    64       let
    65         val k = length ts;
    65         val k = length ts;
    66         val l = case syntax_const c of NONE => args_num c | SOME (l, _) => l;
    66         val l = case syntax_const c of NONE => args_num c | SOME (l, _) => l;
    67         val tys' = if is_pat orelse
    67         val tys' = if is_pat orelse
    68           (is_none (syntax_const c) andalso is_singleton c) then [] else tys;
    68           (is_none (syntax_const c) andalso is_singleton c) then [] else tys;
    69         val (no_syntax, print') = case syntax_const c
    69         val (no_syntax, print') = case syntax_const c
    70          of NONE => (true, fn ts => applify "(" ")" fxy
    70          of NONE => (true, fn ts => applify "(" ")" fxy
    71               (applify "[" "]" NOBR ((str o deresolve) c) (map (print_typ tyvars NOBR) tys'))
    71               (applify "[" "]" NOBR ((str o deresolve) c) (map (print_typ tyvars NOBR) tys'))
    72                 (map (print_term tyvars is_pat thm vars NOBR) ts))
    72                 (map (print_term tyvars is_pat thm vars NOBR) ts))
    73           | SOME (_, print) => (false, fn ts =>
    73           | SOME (_, print) => (false, fn ts =>
    74               print (print_term tyvars is_pat thm) thm vars fxy (ts ~~ take k tys));
    74               print (print_term tyvars is_pat thm) thm vars fxy (ts ~~ take k tys_args));
    75       in if k = l then print' ts
    75       in if k = l then print' ts
    76       else if k < l then
    76       else if k < l then
    77         print_term tyvars is_pat thm vars fxy (Code_Thingol.eta_expand l app)
    77         print_term tyvars is_pat thm vars fxy (Code_Thingol.eta_expand l app)
    78       else let
    78       else let
    79         val (ts1, ts23) = chop l ts;
    79         val (ts1, ts23) = chop l ts;