Skip to content

Commit

Permalink
deprecate either projections
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijn Hoekstra committed May 28, 2018
1 parent 38b2279 commit 2449721
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/library/scala/util/Either.scala
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,14 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* for (e <- interactWithDB(someQuery).left) log(s"query failed, reason was $e")
* }}}
*/
@deprecated("use swap instead", "2.13.0")
def left = Either.LeftProjection(this)

/** Projects this `Either` as a `Right`.
*
* Because `Either` is right-biased, this method is not normally needed.
*/
@deprecated("Either is now right-biased", "2.13.0")
def right = Either.RightProjection(this)

/** Applies `fa` if this is a `Left` or `fb` if this is a `Right`.
Expand Down Expand Up @@ -476,6 +478,7 @@ object Either {
* @version 1.0, 11/10/2008
* @see [[scala.util.Either#left]]
*/
@deprecated("use swap instead", "2.13.0")
final case class LeftProjection[+A, +B](e: Either[A, B]) {
/** Returns the value from this `Left` or throws `java.util.NoSuchElementException`
* if this is a `Right`.
Expand Down Expand Up @@ -620,6 +623,7 @@ object Either {
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
* @version 1.0, 11/10/2008
*/
@deprecated("Either is now right-biased", "2.13.0")
final case class RightProjection[+A, +B](e: Either[A, B]) {

/** Returns the value from this `Right` or throws
Expand Down

0 comments on commit 2449721

Please sign in to comment.