EOr

e.scala.EOr
See theEOr companion object
sealed trait EOr[+A]

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

Type parameters

A

Type of the value this EOr can contain

Attributes

See also

_root_.scala.util.Either

_root_.scala.util.Try

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Failure
class Success[A]
Self type
EOr[A]

Members list

Value members

Concrete methods

infix 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

Type parameters

B

Type of value in next EOr

Value parameters

next

Next EOr in case this one has a value

Attributes

Returns

Next EOr or a new EOr containing E in this one

def filter(condition: A => Boolean, filteredError: A => E): 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

Value parameters

condition

Filtering function

filteredError

E conversion function

Attributes

Returns

This EOr of a new EOr containing an E computed by given conversion function

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

Type parameters

B

Type of the new value

Value parameters

f

Flat mapping function

Attributes

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

Type parameters

AA

Type of the new value

Value parameters

f

E flat mapping function

Attributes

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

Type parameters

B

Type of the desired result

Value parameters

ifFailure

Conversion function for E

ifSuccess

Conversion function for value

Attributes

Returns

Converted result

def foreach[U](f: A => U): Unit

Alias of onValue

Alias of onValue

Attributes

See also
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

Type parameters

AA

Type of default value

Value parameters

default

Default value to use in case this has E

Attributes

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

Type parameters

AA

Type of value returned by partial function

Value parameters

f

Partial function to handle E

Attributes

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

Type parameters

AA

Type of value in EOr returned by partial function

Value parameters

f

Partial function to compute new EOr

Attributes

Returns

Computed new EOr if partial function was defined for E in this EOr or this EOr as is

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

Type parameters

B

Type of the new value

Value parameters

f

Mapping function

Attributes

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

Value parameters

f

E mapping function

Attributes

Returns

This EOr or a new EOr containing computed E if this one has E

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

Type parameters

U

Type of result of the side-effect

Value parameters

f

Side-effecting function

Attributes

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

Type parameters

U

Type of result of the side-effect

Value parameters

f

Side-effecting function

Attributes

infix 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

Type parameters

AA

Type of value in alternative EOr

Value parameters

alternative

Alternative EOr in case this one has E

Attributes

Returns

This EOr or alternative if this one has E

def toEither: Either[E, A]

Converts this EOr to an Either

Converts this EOr to an Either

Attributes

Returns

An Either containing E in this EOr or value in this EOr

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

Value parameters

condition

Filtering function

Attributes

Returns

This EOr of a new EOr containing filtered error

See also

Concrete fields

val error: Option[E]

E in this as an Option

E in this as an Option

Attributes

Whether or not this contains an E

Whether or not this contains an E

Attributes

Whether or not this contains a value

Whether or not this contains a value

Attributes

val value: Option[A]

Value in this as an Option

Value in this as an Option

Attributes