Repository navigation
Switch Positive/Negative/etc. to use irrelevant instance arguments - #1581
Conversation
|
Positivity/negativity has sense for any Ordered (Abelian) Group. |
|
In my Agda work I've found that instance arguments can sometimes slow type checking down a lot. Are there any benchmarks of before and after this change? That aside, sounds great! |
@mechvel I agree, it should be possible to generalise the definitions if done carefully. However this PR is very much about using the definitions and the changes are almost entirely agnostic to the definitions themselves. I'll make a note of your comment in #1175 so it doesn't get forgotten when we come around to generalising the other definitions.
That's an excellent question @technicalguy . Looking at the test suite, it took Lot's of variability there, but I think it's clear that it hasn't significantly boosted type-checking time, even with 100+ uses of instance arguments. I think primarily this is because the instance search is never more than single layer deep at the moment. However even with that single layer of search, there's a ton of benefits. If and when we address #1565 and try and make instance search deeper we should re-evaluate the performance impact. |
This plays the same game with
Positive/Negative/NonPositive/NonNegativeas #1538 did withNonZero. We get all the same benefits as theNonZerocase. Will post something about on Zulip and the mailing list tomorrow.