Skip to content
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

UnorderedFoldable#isEmpty default implementation is incorrect #2584

Closed
durban opened this issue Oct 26, 2018 · 3 comments
Closed

UnorderedFoldable#isEmpty default implementation is incorrect #2584

durban opened this issue Oct 26, 2018 · 3 comments

Comments

@durban
Copy link
Contributor

durban commented Oct 26, 2018

The default implementation of UnorderedFoldable#isEmpty (and thus nonEmpty) seems to be incorrect.

val inst: cats.UnorderedFoldable[Set] = new cats.UnorderedFoldable[Set] {
  def unorderedFoldMap[A, B](s: Set[A])(f: A => B)(implicit B: cats.kernel.CommutativeMonoid[B]): B =
    cats.instances.set.catsStdInstancesForSet.unorderedFoldMap(s)(f)
}

inst.isEmpty(Set.empty) // returns false
@LukaJCB LukaJCB added the bug label Oct 26, 2018
@ceedubs
Copy link
Contributor

ceedubs commented Oct 29, 2018

Ouch. It looks like the implementations of isEmpty and nonEmpty are switched around. The fix is easy, but we should also add some tests for this. This is a super busy week for me. Does anybody want to give it a go?

@barambani
Copy link
Contributor

I can help with this if that's ok

@kailuowang
Copy link
Contributor

closed by #2586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants