From 035b7be498cc99108abf25783a8efa5d5dd8bc6a Mon Sep 17 00:00:00 2001 From: Mickey Donaghy Date: Wed, 9 Oct 2024 15:33:20 +0900 Subject: [PATCH] Add identity law for unorderedFoldMapA --- laws/src/main/scala/cats/laws/UnorderedFoldableLaws.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/laws/src/main/scala/cats/laws/UnorderedFoldableLaws.scala b/laws/src/main/scala/cats/laws/UnorderedFoldableLaws.scala index 31ce99b079..e70df54e0c 100644 --- a/laws/src/main/scala/cats/laws/UnorderedFoldableLaws.scala +++ b/laws/src/main/scala/cats/laws/UnorderedFoldableLaws.scala @@ -30,6 +30,9 @@ trait UnorderedFoldableLaws[F[_]] { def unorderedFoldConsistentWithUnorderedFoldMap[A: CommutativeMonoid](fa: F[A]): IsEq[A] = F.unorderedFoldMap(fa)(identity) <-> F.unorderedFold(fa) + def unorderedFoldMapAIdentity[A, B: CommutativeMonoid](fa: F[A], f: A => B): IsEq[B] = + F.unorderedFoldMapA[Id, A, B](fa)(f) <-> F.unorderedFoldMap(fa)(f) + def forallConsistentWithExists[A](fa: F[A], p: A => Boolean): Boolean = if (F.forall(fa)(p)) { val negationExists = F.exists(fa)(a => !p(a))