grizzled.either.Implicits

RichEither

implicit final class RichEither[L, R] extends AnyVal

Enriched Either class, providing map and flatMap methods that map over and Either object if its value is Right (and permit easier use of Either objects in for comprehensions).

Linear Supertypes
AnyVal, NotNull, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RichEither
  2. AnyVal
  3. NotNull
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RichEither(e: Either[L, R])

Value Members

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

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

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

    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. val e: Either[L, R]

  6. def flatMap[R2](mapper: (R) ⇒ Either[L, R2]): Either[L, R2]

    Similar to the map() method, this method invokes the supplied partial function only if the supplied Either is a Right.

    Similar to the map() method, this method invokes the supplied partial function only if the supplied Either is a Right. Unlike map(), however, flatMap() does not automatically rewrap the result in a Right; instead, it expects the supplied partial function to return an Either.

    This method is roughly analogous to the Scala Option class's flatMap() function.

    R2

    the mapped Right type

    mapper

    Partial function taking a value of type R (i.e., what's stored in the Right side) and maps it to an Either[L, R2].

  7. def getClass(): Class[_ <: AnyVal]

    Definition Classes
    AnyVal → Any
  8. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  9. def map[R2](mapper: (R) ⇒ R2): Either[L, R2]

    Map an Either value only if it's a Right.

    Map an Either value only if it's a Right. If it's a Left, just return the Left unmodified.

    This method is roughly analogous to the Scala Option class's map() function.

    R2

    the mapped Right type

    mapper

    Partial function taking a value of type R (i.e., what's stored in the Right side) and maps it to a value of type R2.

  10. def toString(): String

    Definition Classes
    Any
  11. def toTry: Try[R]

    Convert an Either to a Try.

    Convert an Either to a Try. If the Either is a Right, then the value is extracted from the Right and wrapped in a Success. If the Either is a Left, then the value is extracted from the left, stored in an Exception, and wrapped in a Failure.

    To convert the exception to another exception, you can use .orElse:

    either.toTry.orElse { e => Failure(new MyException(e)) }
    returns

    the Either, converted to a Try

Inherited from AnyVal

Inherited from NotNull

Inherited from Any

Ungrouped