scala.util

Left

final case class Left[+A, +B](a: A) extends Either[A, B] with Product with Serializable

The left side of the disjoint union, as opposed to the scala.util.Right side.

Source
Either.scala
Version

1.0, 11/10/2008

Linear Supertypes
Serializable, java.io.Serializable, Product, Equals, Either[A, B], AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Left
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Either
  7. AnyRef
  8. Any
Implicitly
  1. by MergeableEither
  2. by StringAdd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Left(a: A)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to StringAdd[Left[A, B]] performed by method StringAdd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (Left[A, B], B)

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to ArrowAssoc[Left[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. val a: A

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def ensuring(cond: (Left[A, B]) ⇒ Boolean, msg: ⇒ Any): Left[A, B]

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to Ensuring[Left[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: (Left[A, B]) ⇒ Boolean): Left[A, B]

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to Ensuring[Left[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean, msg: ⇒ Any): Left[A, B]

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to Ensuring[Left[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean): Left[A, B]

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to Ensuring[Left[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  17. def fold[X](fa: (A) ⇒ X, fb: (B) ⇒ X): X

    Applies fa if this is a Left or fb if this is a Right.

    Applies fa if this is a Left or fb if this is a Right.

    fa

    the function to apply if this is a Left

    fb

    the function to apply if this is a Right

    returns

    the results of applying the function

    Definition Classes
    Either
    Example:
    1. val result: Either[Exception, Value] = possiblyFailingOperation()
      log(result.fold(
        ex => "Operation failed with " + ex,
        v => "Operation produced value: " + v
      ))
  18. def formatted(fmtstr: String): String

    Returns string formatted according to given format string.

    Returns string formatted according to given format string. Format strings are as for String.format (@see java.lang.String.format).

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to StringFormat[Left[A, B]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  19. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. def isLeft: Boolean

    Returns true if this is a Left, false otherwise.

    Returns true if this is a Left, false otherwise.

    Left("tulip").isLeft // true
    Right("venus fly-trap").isLeft // false
    Definition Classes
    LeftEither
  22. def isRight: Boolean

    Returns true if this is a Right, false otherwise.

    Returns true if this is a Right, false otherwise.

    Left("tulip").isRight // false
    Right("venus fly-trap").isRight // true
    Definition Classes
    LeftEither
  23. def joinLeft[A1 >: A, B1 >: B, C](implicit ev: <:<[A1, Either[C, B1]]): Either[C, B1]

    Joins an Either through Left.

    Joins an Either through Left.

    This method requires that the left side of this Either is itself an Either type. That is, this must be some type like:

    Either[Either[C, B], B]

    (which respects the type parameter bounds, shown below.)

    If this instance is a Left[Either[C, B]] then the contained Either[C, B] will be returned, otherwise this value will be returned unmodified.

    Left[Either[Int, String], String](Right("flower")).joinLeft // Result: Right("flower")
    Left[Either[Int, String], String](Left(12)).joinLeft // Result: Left(12)
    Right[Either[Int, String], String]("daisy").joinLeft // Result: Right("daisy")

    This method, and joinRight, are analogous to Option#flatten

    Definition Classes
    Either
  24. def joinRight[A1 >: A, B1 >: B, C](implicit ev: <:<[B1, Either[A1, C]]): Either[A1, C]

    Joins an Either through Right.

    Joins an Either through Right.

    This method requires that the right side of this Either is itself an Either type. That is, this must be some type like:

    Either[A, Either[A, C]]

    (which respects the type parameter bounds, shown below.)

    If this instance is a Right[Either[A, C]] then the contained Either[A, C] will be returned, otherwise this value will be returned unmodified.

    Definition Classes
    Either
    Example:
    1. Right[String, Either[String, Int]](Right(12)).joinRight // Result: Right(12)
      Right[String, Either[String, Int]](Left("flower")).joinRight // Result: Left("flower")
      Left[String, Either[String, Int]]("flower").joinRight // Result: Left("flower")

      This method, and joinLeft, are analogous to Option#flatten

  25. def left: LeftProjection[A, B]

    Projects this Either as a Left.

    Projects this Either as a Left.

    Definition Classes
    Either
  26. def merge: B

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to MergeableEither[B] performed by method MergeableEither in scala.util.Either.
    Definition Classes
    MergeableEither
  27. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  30. def right: RightProjection[A, B]

    Projects this Either as a Right.

    Projects this Either as a Right.

    Definition Classes
    Either
  31. def swap: Product with Serializable with Either[B, A]

    If this is a Left, then return the left value in Right or vice versa.

    If this is a Left, then return the left value in Right or vice versa.

    Definition Classes
    Either
    Example:
    1. val l: Either[String, Int] = Left("left")
      val r: Either[Int, String] = l.swap // Result: Right("left")
  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  33. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  34. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  35. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  36. def [B](y: B): (Left[A, B], B)

    Implicit information
    This member is added by an implicit conversion from Left[A, B] to ArrowAssoc[Left[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Serializable

Inherited from java.io.Serializable

Inherited from Product

Inherited from Equals

Inherited from Either[A, B]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion MergeableEither from Left[A, B] to MergeableEither[B]

Inherited by implicit conversion StringAdd from Left[A, B] to StringAdd[Left[A, B]]

Inherited by implicit conversion StringFormat from Left[A, B] to StringFormat[Left[A, B]]

Inherited by implicit conversion Ensuring from Left[A, B] to Ensuring[Left[A, B]]

Inherited by implicit conversion ArrowAssoc from Left[A, B] to ArrowAssoc[Left[A, B]]

Ungrouped