-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add more standard rules and eliminate Seq views #9
Add more standard rules and eliminate Seq views #9
Conversation
…his way more types get Indexable behaviors for free.
…ren't restricted to foldable for length methods, update tests
Codecov Report
@@ Coverage Diff @@
## develop #9 +/- ##
===========================================
+ Coverage 79.47% 81.59% +2.12%
===========================================
Files 10 13 +3
Lines 151 201 +50
Branches 0 2 +2
===========================================
+ Hits 120 164 +44
- Misses 31 37 +6
Continue to review full report at Codecov.
|
@davegurnell Hey dave, just checking to see if you saw this. |
I have now! It all looks good except for one thing, which I think is a bigger design problem with the library in general that needs to be sorted in the medium term. I'll merge this now anyway and raise an issue to discuss the design problem. |
In this PR, I've created strict variants of all the base property rules, and I've removed the Seq view restrictions that were on some of them... Instead, they now depend on either
Foldable
,Sizeable
,Monoid
, orIndexable
.Sizeable
is just a typeclass for things which have size.Indexable
was updated to be based onmapWithIndex
rather thanzipWithIndex
. This lets us generalizeIndexable
, such that forallF[_]: Foldable
,F
is alsoIndexable
. Additionally,Indexable
will be able to be removed once we move to cats 1.0.0, since these things are built in toTraverse
there.Monoid
is used for the non-empty rule, rather than the seq view that was there before. This means users can define their own things which may be empty.Some consequences of this, are that
Seq
won't work for anything which depends on Foldable. Depending on cats' alleycats package should get you unlawful typeclasses for those, however.