equal
deleted
inserted
replaced
638 val U = fastype_of success_t; |
638 val U = fastype_of success_t; |
639 val U' = dest_monadT compfuns U; |
639 val U' = dest_monadT compfuns U; |
640 val v = Free (name, T); |
640 val v = Free (name, T); |
641 val v' = Free (name', T); |
641 val v' = Free (name', T); |
642 in |
642 in |
643 lambda v (Datatype_Case.make_case ctxt Datatype_Case.Quiet [] v |
643 lambda v (Datatype_Case.make_case ctxt Datatype_Case.Quiet Name.context v |
644 [(HOLogic.mk_tuple out_ts, |
644 [(HOLogic.mk_tuple out_ts, |
645 if null eqs'' then success_t |
645 if null eqs'' then success_t |
646 else Const (@{const_name HOL.If}, HOLogic.boolT --> U --> U --> U) $ |
646 else Const (@{const_name HOL.If}, HOLogic.boolT --> U --> U --> U) $ |
647 foldr1 HOLogic.mk_conj eqs'' $ success_t $ |
647 foldr1 HOLogic.mk_conj eqs'' $ success_t $ |
648 mk_empty compfuns U'), |
648 mk_empty compfuns U'), |
914 val compilation = the_default (mk_empty compfuns (HOLogic.mk_tupleT outTs)) |
914 val compilation = the_default (mk_empty compfuns (HOLogic.mk_tupleT outTs)) |
915 (compile_switch_tree (argnames @ x :: all_vs) ctxt_eqs' switched) |
915 (compile_switch_tree (argnames @ x :: all_vs) ctxt_eqs' switched) |
916 in |
916 in |
917 (pattern, compilation) |
917 (pattern, compilation) |
918 end |
918 end |
919 val switch = Datatype_Case.make_case ctxt Datatype_Case.Quiet [] inp_var |
919 val switch = Datatype_Case.make_case ctxt Datatype_Case.Quiet Name.context inp_var |
920 ((map compile_single_case switched_clauses) @ |
920 ((map compile_single_case switched_clauses) @ |
921 [(xt, mk_empty compfuns (HOLogic.mk_tupleT outTs))]) |
921 [(xt, mk_empty compfuns (HOLogic.mk_tupleT outTs))]) |
922 in |
922 in |
923 case compile_switch_tree all_vs ctxt_eqs left_clauses of |
923 case compile_switch_tree all_vs ctxt_eqs left_clauses of |
924 NONE => SOME switch |
924 NONE => SOME switch |