with_exn : ('a -> 'b) -> 'a -> exn -> 'b
- with_exn dest_comb (Term`\x. x /\ y`) (Fail "My kingdom for a horse"); ! Uncaught exception: ! Fail "My kingdom for a horse" - with_exn (fn _ => raise Interrupt) 1 (Fail "My kingdom for a horse"); > Interrupted.
local val expected = mk_HOL_ERR "" "dest_quant" "expected !v.M or ?v.M" in fun dest_quant tm = let val (q,body) = with_exn dest_comb tm expected val (p as (v,M)) = with_exn dest_abs body expected in if q = universal orelse q = existential then p else raise expected end end