Skip to content

Commit 7532bca

Browse files
author
Martijn Hoekstra
committed
deprecate either projections
1 parent f4ea881 commit 7532bca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/src/scala/util/Either.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
162162
* for (e <- interactWithDB(someQuery).left) log(s"query failed, reason was $e")
163163
* }}}
164164
*/
165+
@deprecated("use swap instead", "2.13.0")
165166
def left = Either.LeftProjection(this)
166167

167168
/** Projects this `Either` as a `Right`.
168169
*
169170
* Because `Either` is right-biased, this method is not normally needed.
170171
*/
172+
@deprecated("Either is now right-biased", "2.13.0")
171173
def right = Either.RightProjection(this)
172174

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

625629
/** Returns the value from this `Right` or throws

0 commit comments

Comments
 (0)