-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 distinct method to NonEmptyList and NonEmptyVector. #1240
Conversation
Thanks for submitting this @Tvaroh! I was thinking about wanting a There are a few complications:
I'm not quite sure how to go forward. I wonder if anyone else has any thoughts on this? |
@ceedubs I understand. Writing a balanced ordered tree-based set might be complicated, not sure if it's even in cats' scope. |
Short of writing our own tree, perhaps we can use |
Current coverage is 89.86% (diff: 0.00%)@@ master #1240 diff @@
==========================================
Files 243 243
Lines 3285 3295 +10
Methods 3231 3240 +9
Messages 0 0
Branches 51 52 +1
==========================================
Hits 2961 2961
- Misses 324 334 +10
Partials 0 0
|
Gents, I've updated the PR with Let me know if this is acceptable. |
# Conflicts: # core/src/main/scala/cats/data/NonEmptyVector.scala # tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala
Have added tests and resolved conflicts with master. Unfortunately |
@Tvaroh I usually use |
@ceedubs thanks, it works and tests pass. |
This approach seems reasonable to me. I'd like for a couple others to weigh in on this. @Tvaroh could you please remove the unrelated formatting changes from your PR? They don't follow the conventions used elsewhere in the code base. I could see it being useful to have a |
@ceedubs omg, didn't notice that, blame Intellij. Let me better create a new PR from master to not pollute the git log with unrelated changes. |
See #1243. |
Hello.
Does it make sense to have
distinct
method onNonEmptyList
? If this is something that could be accepted I might work on unit tests for this.The implementation is based on universal equality to compare values. Using
Eq
would require a typeclass for getting hash codes and someSet
implementation that would use those.