diff --git a/build.sbt b/build.sbt index f7f67baa10..c57abfeb75 100644 --- a/build.sbt +++ b/build.sbt @@ -248,6 +248,14 @@ def mimaSettings(moduleName: String) = Seq( exclude[ReversedMissingMethodProblem]("cats.NonEmptyParallel.parForEffect"), exclude[ReversedMissingMethodProblem]("cats.NonEmptyParallel.parFollowedBy"), exclude[ReversedMissingMethodProblem]("cats.syntax.ParallelSyntax.catsSyntaxParallelAp"), + exclude[DirectMissingMethodProblem]("cats.FlatMap.>>="), + exclude[DirectMissingMethodProblem]("cats.FlatMap#Ops.>>="), + exclude[IncompatibleMethTypeProblem]("cats.syntax.FlatMapOps.>>"), + exclude[IncompatibleMethTypeProblem]("cats.syntax.FlatMapOps.>>$extension"), + exclude[DirectMissingMethodProblem]("cats.data.IndexedStateTMonad.>>="), + exclude[DirectMissingMethodProblem]("cats.data.RWSTMonad.>>="), + exclude[DirectMissingMethodProblem]("cats.data.CokleisliMonad.>>="), + exclude[DirectMissingMethodProblem]("cats.instances.FlatMapTuple2.>>="), exclude[DirectMissingMethodProblem]("cats.Applicative.traverse"), exclude[DirectMissingMethodProblem]("cats.Applicative.sequence"), exclude[DirectMissingMethodProblem]("cats.data.IndexedStateTMonad.traverse"), @@ -262,6 +270,7 @@ def mimaSettings(moduleName: String) = Seq( exclude[DirectMissingMethodProblem]("cats.data.ValidatedApplicative.sequence"), exclude[DirectMissingMethodProblem]("cats.data.RWSTAlternative.traverse"), exclude[DirectMissingMethodProblem]("cats.data.RWSTAlternative.sequence") + ) } ) diff --git a/core/src/main/scala/cats/FlatMap.scala b/core/src/main/scala/cats/FlatMap.scala index 1c4b12f0f3..cec786c763 100644 --- a/core/src/main/scala/cats/FlatMap.scala +++ b/core/src/main/scala/cats/FlatMap.scala @@ -20,11 +20,6 @@ import simulacrum.typeclass @typeclass trait FlatMap[F[_]] extends Apply[F] { def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] - /** - * Alias for [[flatMap]]. - */ - def >>=[A, B](fa: F[A])(f: A => F[B]): F[B] = flatMap(fa)(f) - /** * "flatten" a nested `F` of `F` structure into a single-layer `F` structure. * diff --git a/core/src/main/scala/cats/syntax/flatMap.scala b/core/src/main/scala/cats/syntax/flatMap.scala index 4342b42788..e3c8f14a5e 100644 --- a/core/src/main/scala/cats/syntax/flatMap.scala +++ b/core/src/main/scala/cats/syntax/flatMap.scala @@ -18,8 +18,19 @@ trait FlatMapSyntax extends FlatMap.ToFlatMapOps { final class FlatMapOps[F[_], A](val fa: F[A]) extends AnyVal { - @deprecated("Use *> instead", "1.0.0-RC1") - def >>[B](fb: F[B])(implicit F: FlatMap[F]): F[B] = F.followedBy(fa)(fb) + /** + * Alias for [[flatMap]]. + */ + def >>=[B](f: A => F[B])(implicit F: FlatMap[F]): F[B] = F.flatMap(fa)(f) + + /** + * Alias for `fa.flatMap(_ => fb)`. + * + * Unlike `*>`, `fb` is defined as a by-name parameter, allowing this + * method to be used in cases where computing `fb` is not stack safe + * unless suspended in a `flatMap`. + */ + def >>[B](fb: => F[B])(implicit F: FlatMap[F]): F[B] = F.flatMap(fa)(_ => fb) @deprecated("Use <* instead", "1.0.0-RC1") def <<[B](fb: F[B])(implicit F: FlatMap[F]): F[A] = F.forEffect(fa)(fb)