coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Dan Frumin <dfrumin AT cs.ru.nl>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Backticks and universally quantified typeclass instances
- Date: Thu, 10 Nov 2016 17:32:50 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=dfrumin AT cs.ru.nl; spf=None smtp.mailfrom=dan AT ip-145-116-190-54.wlan-int.ru.nl; spf=None smtp.helo=postmaster AT ip-145-116-190-54.wlan-int.ru.nl
- Ironport-phdr: 9a23:PbUnwxUSN+GTj5ubSqUN7r/ZilTV8LGtZVwlr6E/grcLSJyIuqrYYxCFt8tkgFKBZ4jH8fUM07OQ6PG7HzRbqsbQ+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe71/IRG4oAnLqsUbj4RuJ6U1xxDUvnZGZuNayH9yK1mOhRj8/MCw/JBi8yRUpf0s8tNLXLv5caolU7FWFSwqPG8p6sLlsxnDVhaP6WAHUmoKiBpIAhPK4w/8U5zsryb1rOt92C2dPc3rUbA5XCmp4ql3RBP0jioMKjg0+3zVhMNtlqJWuByvqRxhzYDJY4+VOvVxcb/ActwYS2VMRdpRWzBdDo+gc4cCFfQNMOBFpIf9vVsOqh6+CBGiCuz1zD9Dm3/43bcn0+QkEAHG2hErEtUTv3TattX1KaISUeGzzKTT0TrDdOla2S3g6ITSdBAhpeiBULRtesTS0UkiDx7Jg1qQpID/Ij+Zy+UAv3KG4+dkSe6jkW4qpg53rzOy3MkjkJPJiZgQyl3c9SV23oI1JdqgRU56ed6oCYZcui6aOodvX88uXmBltD8nxrACpZK3ZSgHxZs9yx/Rb/yIaY6I7gviVOaXPTd0nmhleK+lixa09Uis0uz8Vs+q31ZWtidJj9bBu3AX2xDO98SKS+Fx8lql1DqTzQze6u5JLVgxlaXBKp4hxrAwloAUsUTGBiL5hV/5jKmNe0Ul4uik8vnrb7rmq5OFKoN4lwDzPr0zlsG7Heg0KwgDUmeB9eWy0L3s50v5TKxLjv0wjqnVqoraJdkBqq6/Bw9Zypwj5AqnDze6zNQYmmEKI05CeBKeloTmJ1XOIO3jAvqkmFStkDJrx+jcMbH7A5XNKGLDkLb7crpn5U5c0ll78dcK7JVNT7oFPfjbW0nrtdWeAAVqHRazxrPLAdM1+JkDXGOJSvuVPrnPtF6Ozuk0ZfORIokR7mWuY8M57uLj2Cdq0WQWerOkiMMa
Dear Jonathan,
On 11/10, Jonathan Leivent wrote:
Is this what you want?:
Class tcA (T: Type).
Class tcB (T: Type) `{tcA T}.
Variable T : Type -> Type.
Context `{forall A, tcA (T A)}.
Context `{forall A, (tcB (T A))}.
or this?:
Class tcA (T: Type).
Class tcB (T: Type) `{tcA T}.
Variable T : Type -> Type.
Context `{forall A, {b:tcA (T A) & (@tcB (T A) b)}}.
I don't really care about specific instances, so both snippets are
fine with me. The problem is that in my actual code, as opposed to
this small example, the second type class depends on 6 other
typeclasses, each one of those typeclasses may depend on a couple of
other typeclasses, thus resulting in a lot of boilerplate code.
I was wondering if there is a known way to circumvent such situations.
- Dan
-- Jonathan
On 11/10/2016 09:53 AM, Dan Frumin wrote:
Dear *,
I ran into the following problem recently. Suppose I have typeclasses
(tcA T) and (tcB T) for (T : Type), whereby the second typeclass
depends on the first one.
Class tcA (T: Type).
Class tcB (T: Type) `{tcA T}.
If I have a [Parameter]/[Variable]
(A : Type) then I can write
Context `{tcB A}.
and the backtick magic will register both instances for [tcB A] and
[tcA A]. However, if I have a type family T, and I want to assert [tcB
(T A)] for all types A, I run into a problem.
Variable T : Type -> Type.
Context `{forall A, (tcB (T A))}.
Error: Cannot infer the implicit parameter H of tcB whose type is "tcA (T A)" (no type class instance found) in environment:
A : Type
It makes sense that it doesn't work, but does anyone know of a
workaround for this?
Kind regards,
- Dan
- [Coq-Club] Backticks and universally quantified typeclass instances, Dan Frumin, 11/10/2016
- Re: [Coq-Club] Backticks and universally quantified typeclass instances, Jonathan Leivent, 11/10/2016
- Re: [Coq-Club] Backticks and universally quantified typeclass instances, Dan Frumin, 11/10/2016
- Re: [Coq-Club] Backticks and universally quantified typeclass instances, Jonathan Leivent, 11/10/2016
- Re: [Coq-Club] Backticks and universally quantified typeclass instances, Dan Frumin, 11/10/2016
- Re: [Coq-Club] Backticks and universally quantified typeclass instances, Jonathan Leivent, 11/10/2016
Archive powered by MHonArc 2.6.18.