diff --git a/core/src/main/scala/cats/Foldable.scala b/core/src/main/scala/cats/Foldable.scala index b0a5fb2701..0e2d8b69e5 100644 --- a/core/src/main/scala/cats/Foldable.scala +++ b/core/src/main/scala/cats/Foldable.scala @@ -199,13 +199,13 @@ import Foldable.sentinel * @return `None` if the structure is empty, otherwise the minimum element * wrapped in a `Some`. * - * @see [[Reducible#minimum]] for a version that doesn't need to return an + * @see [[Reducible#minimumBy]] for a version that doesn't need to return an * `Option` for structures that are guaranteed to be non-empty. * - * @see [[maximumOptionBy]] for maximum instead of minimum. + * @see [[maximumByOption]] for maximum instead of minimum. */ - def minimumOptionBy[A, B: Order](fa: F[A])(f: A => B)(implicit F: Foldable[F]): Option[A] = - F.minimumOption(fa)(Order.by(f)) + def minimumByOption[A, B: Order](fa: F[A])(f: A => B): Option[A] = + minimumOption(fa)(Order.by(f)) /** * Find the maximum `A` item in this structure according to an `Order.by(f)`. @@ -213,13 +213,13 @@ import Foldable.sentinel * @return `None` if the structure is empty, otherwise the maximum element * wrapped in a `Some`. * - * @see [[Reducible#maximum]] for a version that doesn't need to return an + * @see [[Reducible#maximumBy]] for a version that doesn't need to return an * `Option` for structures that are guaranteed to be non-empty. * - * @see [[minimumOptionBy]] for minimum instead of maximum. + * @see [[minimumByOption]] for minimum instead of maximum. */ - def maximumOptionBy[A, B: Order](fa: F[A])(f: A => B)(implicit F: Foldable[F]): Option[A] = - F.maximumOption(fa)(Order.by(f)) + def maximumByOption[A, B: Order](fa: F[A])(f: A => B): Option[A] = + maximumOption(fa)(Order.by(f)) /** * Get the element at the index of the `Foldable`. diff --git a/core/src/main/scala/cats/Reducible.scala b/core/src/main/scala/cats/Reducible.scala index a0e60b2cb5..f41161b558 100644 --- a/core/src/main/scala/cats/Reducible.scala +++ b/core/src/main/scala/cats/Reducible.scala @@ -161,16 +161,16 @@ import simulacrum.typeclass * * @see [[maximumBy]] for maximum instead of minimum. */ - def minimumBy[A, B: Order](fa: F[A])(f: A => B)(implicit F: Reducible[F]): A = - F.minimum(fa)(Order.by(f)) + def minimumBy[A, B: Order](fa: F[A])(f: A => B): A = + minimum(fa)(Order.by(f)) /** * Find the maximum `A` item in this structure according to an `Order.by(f)`. * * @see [[minimumBy]] for minimum instead of maximum. */ - def maximumBy[A, B: Order](fa: F[A])(f: A => B)(implicit F: Reducible[F]): A = - F.maximum(fa)(Order.by(f)) + def maximumBy[A, B: Order](fa: F[A])(f: A => B): A = + maximum(fa)(Order.by(f)) /** * Intercalate/insert an element between the existing elements while reducing. diff --git a/tests/src/test/scala/cats/tests/FoldableSuite.scala b/tests/src/test/scala/cats/tests/FoldableSuite.scala index 6da3d78b09..addf449232 100644 --- a/tests/src/test/scala/cats/tests/FoldableSuite.scala +++ b/tests/src/test/scala/cats/tests/FoldableSuite.scala @@ -194,8 +194,8 @@ abstract class FoldableSuite[F[_]: Foldable](name: String)(implicit ArbFInt: Arb test(s"Foldable[$name].maximumBy/minimumBy") { forAll { (fa: F[Int], f: Int => Int) => - val maxOpt = fa.maximumOptionBy(f).map(f) - val minOpt = fa.minimumOptionBy(f).map(f) + val maxOpt = fa.maximumByOption(f).map(f) + val minOpt = fa.minimumByOption(f).map(f) val nelOpt = fa.toList.toNel maxOpt should ===(nelOpt.map(_.maximumBy(f)).map(f)) maxOpt should ===(nelOpt.map(_.toList.maxBy(f)).map(f))