coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Matthieu Sozeau <mattam AT mattam.org>
- To: Jason Gross <jasongross9 AT gmail.com>
- Cc: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Typeclasses and evars
- Date: Tue, 9 Jul 2013 17:58:02 +0200
Le 9 juil. 2013 à 03:19, Jason Gross
<jasongross9 AT gmail.com>
a écrit :
> Is there a way to forbid typeclass resolution from applying a particular
> instance to a goal with evars in it? For example, if I have the typeclass
> [Foo : nat -> Type -> Type], and I have an instance [forall `{Foo (S n) T}
> (x y : T), Foo n (x = y)], and I want to prevent Coq from running off into
> the woods by trying to solve the goal [Foo 1 ?1] by instantiating [?1] with
> [@eq ?2 ?3 ?4] and trying to find [Foo 2 ?2], and repeating the process
> forever.
There is a way, using:
[Hint Extern (Foo _ (_ = _)) => apply inst : typeclass_instances]
It's a bit hackish but the pattern must match precisely, and (_ = _)
does not pattern-match against ?1. Another way is to use the [not_evar t]
tactic that succeeds iff [t] is not an evar.
-- Matthieu
- [Coq-Club] Typeclasses and evars, Jason Gross, 07/09/2013
- Re: [Coq-Club] Typeclasses and evars, Matthieu Sozeau, 07/09/2013
Archive powered by MHonArc 2.6.18.