Skip to content

Commit

Permalink
Removed deprecation of >> and changed its param to be a by-name (#2043)
Browse files Browse the repository at this point in the history
* Removed deprecation of >> and changed its param to be a by-name

* Adjusted mima exclusions
  • Loading branch information
mpilquist authored and kailuowang committed Nov 26, 2017
1 parent bd940c5 commit 563f612
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
9 changes: 9 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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")

)
}
)
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/scala/cats/FlatMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
15 changes: 13 additions & 2 deletions core/src/main/scala/cats/syntax/flatMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 563f612

Please sign in to comment.