Often with_exn can be used to clean up programming where lots of
exceptions may be handled. For example, taking apart a compound term of
a certain desired form may fail at several places, but a uniform error
message is desired.
   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