Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] how to (almost) do Ltac try/raise in 8.5

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] how to (almost) do Ltac try/raise in 8.5


Chronological Thread 
  • From: Pierre-Marie Pédrot <pierre-marie.pedrot AT inria.fr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] how to (almost) do Ltac try/raise in 8.5
  • Date: Fri, 27 Feb 2015 12:13:30 +0100

On 27/02/2015 04:31, Jonathan Leivent wrote:
> However, in 8.5, one can do the following:
>
> Inductive maybeException {T:Type} : Type :=
> | Exception(val:T)
> | NoException(val:T).
>
> Axiom raised : forall T (val:T) X, X.
>
> Ltac raise val := apply (raised _ val).
>
> Ltac catch tac type :=
> let X:=constr:($(tac)$ : type) in
> lazymatch X with
> | context [raised] =>
> multimatch X with
> | context [raised _ ?V _] => constr:(Exception V)
> end
> | _ => constr:(NoException X)
> end.

The more I see the horrendous hacks people build up using tactics in
terms, the more I regret having introduced this feature without thinking
twice about how people use Ltac.

Timeo tacticas et dona ferentes...

PMP


Attachment: signature.asc
Description: OpenPGP digital signature




Archive powered by MHonArc 2.6.18.

Top of Page