-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interface resolution bug #356
Comments
Diamond shaped inheritance structures are awkward because implementations of the same interface aren't guaranteed to be equal. There's a bit of noise in the error message, but it looks like it doesn't know whether to go to Semigroup via Monoid or VerifiedSemigroup. So, this code as it stands isn't going to work without some modification. This diamond issue is a pain and I don't know if anyone has found a nice solution for this sort of problem (with proofs) yet. By the way, I don't think we should use the names |
I'm pretty sure this is what's responsible for blocking the proof at https://github.com/idris-lang/Idris-dev/pull/4848/files#diff-fb2a7c0a9ce133762a38755823a01d7aR73.
|
This change does not fix the issue, or even affect the error message: -interface (VerifiedSemigroup a, Monoid a) => VerifiedMonoid a where
+interface (Monoid a, VerifiedSemigroup a) => VerifiedMonoid a where |
@edwinb I'm not sure if this fits the problem, but the comment reminds me of the recent Tabled Typeclass Resolution paper. |
@nickdrozd once suggested in a dicussion on Idris-dev repo, that these interfaces should actually be merged together (i.e. |
Steps to Reproduce
Stick this code at the bottom of Prelude.idr:
Expected Behavior
No problem
Observed Behavior
mtimesTimes
fails with this error:But the proof itself is fine, and it goes through with this change:
mtimes
, with theMonoid
constraint, says, if you implement those syntactic elements, you get to use this syntactic element.mtimesTimes
, with theVerifiedMonoid
constraint, says, if you further prove certain guarantees about the behavior of those syntactic elements, you also get some guarantees about the behavior of this new element. So the "verified" constraint shouldn't be necessary for definingmtimes
, becausemtimes
doesn't make any guarantees about behavior.The inheritance structure looks like this:
This bug is in Idris 1 too.
The text was updated successfully, but these errors were encountered: