Skip to content

Commit 9b6a6fd

Browse files
authored
In Apply.semigroup test replace ListWrapper with Option (#2827)
* In Apply.semigroup test replace ListWrapper with Option * fmt * address feedback
1 parent 422c989 commit 9b6a6fd

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

core/src/main/scala/cats/Apply.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ trait Apply[F[_]] extends Functor[F] with InvariantSemigroupal[F] with ApplyArit
216216
}
217217

218218
object Apply {
219+
220+
/**
221+
* This semigroup uses a product operation to combine `F`s.
222+
* If the `Apply[F].product` results in larger `F` (i.e. when `F` is a `List`),
223+
* accumulative usage of this instance, such as `combineAll`, will result in
224+
* `F`s with exponentially increasing sizes.
225+
*/
219226
def semigroup[F[_], A](implicit f: Apply[F], sg: Semigroup[A]): Semigroup[F[A]] =
220227
new ApplySemigroup[F, A](f, sg)
221228
}

tests/src/test/scala/cats/tests/ApplicativeSuite.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class ApplicativeSuite extends CatsSuite {
4646
}
4747

4848
{
49-
implicit val listwrapperApply = ListWrapper.applyInstance
50-
implicit val listwrapperSemigroup = Apply.semigroup[ListWrapper, Int]
51-
checkAll("Apply[ListWrapper].semigroup", SemigroupTests[ListWrapper[Int]].semigroup)
49+
val optionSemigroupFromApply = Apply.semigroup[Option, Int]
50+
checkAll("Apply[Option].semigroup", SemigroupTests[Option[Int]](optionSemigroupFromApply).semigroup)
5251
}
52+
5353
{
5454
implicit val listwrapperApplicative = ListWrapper.applicative
5555
implicit val listwrapperCoflatMap = Applicative.coflatMap[ListWrapper]

0 commit comments

Comments
 (0)