Skip to content

Commit

Permalink
Removed deprecation of >> and changed its param to be a by-name
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Nov 25, 2017
1 parent d4a3cf5 commit 8f74c9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
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 8f74c9c

Please sign in to comment.