sealed trait EOr[+A] extends AnyRef
A container that can either be a Failure containing an E or Success containing a value, semantically a combination of Either and Try but specialized for E
- A
Type of the value this EOr can contain
- Self Type
- EOr[A]
- See also
- Alphabetic
- By Inheritance
- EOr
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[B](next: => EOr[B]): EOr[B]
Provides a next EOr if this one has a value, ignoring the value
Provides a next EOr if this one has a value, ignoring the value
- B
Type of value in next EOr
- next
Next EOr in case this one has a value
- returns
Next EOr or a new EOr containing E in this one
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- val error: Option[E]
E in this as an Option
- def filter(condition: (A) => Boolean, filteredError: (A) => E = a => EOr.filteredError.data("value", a)): EOr[A]
Filters this EOr by value in it, if it exists, using given function
Filters this EOr by value in it, if it exists, using given function
- condition
Filtering function
- filteredError
E conversion function
- returns
This EOr of a new EOr containing an E computed by given conversion function
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatMap[B](f: (A) => EOr[B]): EOr[B]
Computes a new EOr using value in this, if it exists, with given flat mapping function
Computes a new EOr using value in this, if it exists, with given flat mapping function
- B
Type of the new value
- f
Flat mapping function
- returns
Computed EOr or a new EOr containing E in this one
- def flatMapError[AA >: A](f: (E) => EOr[AA]): EOr[AA]
Computes a new EOr using E in this, if it exists, with given flat mapping function
Computes a new EOr using E in this, if it exists, with given flat mapping function
- AA
Type of the new value
- f
E flat mapping function
- returns
This EOr or a computed EOr if this one has E
- def fold[B](ifFailure: (E) => B, ifSuccess: (A) => B): B
Folds this into a single value, handling both E and value conversions with given functions
Folds this into a single value, handling both E and value conversions with given functions
- B
Type of the desired result
- ifFailure
Conversion function for E
- ifSuccess
Conversion function for value
- returns
Converted result
- def foreach[U](f: (A) => U): Unit
Alias of
onValue
Alias of
onValue
- See also
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getOrElse[AA >: A](default: => AA): AA
Gets the value in this or falls back to given default value
Gets the value in this or falls back to given default value
- AA
Type of default value
- default
Default value to use in case this has E
- returns
Value in this or given default value
- def handle[AA >: A](f: PartialFunction[E, AA]): EOr[AA]
Handles E in this EOr, if it exists, by given partial function to compute a successful EOr
Handles E in this EOr, if it exists, by given partial function to compute a successful EOr
- AA
Type of value returned by partial function
- f
Partial function to handle E
- returns
A new EOr containing handled value if partial function was defined for E in this EOr or this EOr as is
- def handleWith[AA >: A](f: PartialFunction[E, EOr[AA]]): EOr[AA]
Handles E in this EOr, if it exists, by given partial function to compute a new EOr
Handles E in this EOr, if it exists, by given partial function to compute a new EOr
- AA
Type of value in EOr returned by partial function
- f
Partial function to compute new EOr
- returns
Computed new EOr if partial function was defined for E in this EOr or this EOr as is
- val hasError: Boolean
Whether or not this contains an E
- val hasValue: Boolean
Whether or not this contains a value
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (A) => B): EOr[B]
Converts value in this, if it exists, using given mapping function to make a new EOr
Converts value in this, if it exists, using given mapping function to make a new EOr
- B
Type of the new value
- f
Mapping function
- returns
A new EOr containing either the new value or E in this one
- def mapError(f: (E) => E): EOr[A]
Converts E in this, if it exists, using given mapping function to make a new EOr
Converts E in this, if it exists, using given mapping function to make a new EOr
- f
E mapping function
- returns
This EOr or a new EOr containing computed E if this one has E
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def onError[U](f: (E) => U): EOr[A]
Performs a side-effect using error in this, if it exists
Performs a side-effect using error in this, if it exists
- U
Type of result of the side-effect
- f
Side-effecting function
- def onValue[U](f: (A) => U): EOr[A]
Performs a side-effect using value in this, if it exists
Performs a side-effect using value in this, if it exists
- U
Type of result of the side-effect
- f
Side-effecting function
- def orElse[AA >: A](alternative: => EOr[AA]): EOr[AA]
Provides an alternative EOr if this one has E, ignoring the E
Provides an alternative EOr if this one has E, ignoring the E
- AA
Type of value in alternative EOr
- alternative
Alternative EOr in case this one has E
- returns
This EOr or alternative if this one has E
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- val value: Option[A]
Value in this as an Option
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withFilter(condition: (A) => Boolean): EOr[A]
Filters this EOr by value in it, if it exists, using given function
Filters this EOr by value in it, if it exists, using given function
- condition
Filtering function
- returns
This EOr of a new EOr containing filtered error
- See also