Attempt

scodec.Attempt
See theAttempt companion object
sealed abstract class Attempt[+A] extends Product with Serializable

Right biased Either[Err, A].

An Attempt is either an Attempt.Successful or an Attempt.Failure. Attempts can be created by calling Attempt.successful or Attempt.failure, as well as converting from an Option via fromOption.

Attributes

Companion:
object
Source:
Attempt.scala
Graph
Supertypes
trait Product
trait Equals
class Object
trait Matchable
class Any
Known subtypes
class Failure
class Successful[A]

Members list

Concise view

Value members

Abstract methods

def flatMap[B](f: A => Attempt[B]): Attempt[B]

Maps the supplied function over the successful value, if present.

Maps the supplied function over the successful value, if present.

Attributes

Source:
Attempt.scala
def flatten[B](using A <:< Attempt[B]): Attempt[B]

Converts an Attempt[Attempt[X]] in to an Attempt[X].

Converts an Attempt[Attempt[X]] in to an Attempt[X].

Attributes

Source:
Attempt.scala
def fold[B](ifFailure: Err => B, ifSuccessful: A => B): B

Transforms this attempt to a value of type B using the supplied functions.

Transforms this attempt to a value of type B using the supplied functions.

Attributes

Source:
Attempt.scala
def getOrElse[B >: A](default: => B): B

Returns the sucessful value if successful, otherwise the supplied default.

Returns the sucessful value if successful, otherwise the supplied default.

Attributes

Source:
Attempt.scala

True if attempt was successful.

True if attempt was successful.

Attributes

Source:
Attempt.scala
def map[B](f: A => B): Attempt[B]

Maps the supplied function over the successful value, if present.

Maps the supplied function over the successful value, if present.

Attributes

Source:
Attempt.scala
def mapErr(f: Err => Err): Attempt[A]

Maps the supplied function over the failure error, if present.

Maps the supplied function over the failure error, if present.

Attributes

Source:
Attempt.scala
def orElse[B >: A](fallback: => Attempt[B]): Attempt[B]

Returns this attempt if successful, otherwise the fallback attempt.

Returns this attempt if successful, otherwise the fallback attempt.

Attributes

Source:
Attempt.scala
def recover[B >: A](f: PartialFunction[Err, B]): Attempt[B]

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, a successful attempt is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, a successful attempt is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

Attributes

Source:
Attempt.scala
def recoverWith[B >: A](f: PartialFunction[Err, Attempt[B]]): Attempt[B]

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, the result of applying that function is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, the result of applying that function is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

Attributes

Source:
Attempt.scala
def require: A

Returns the successful value if present; otherwise throws an IllegalArgumentException.

Returns the successful value if present; otherwise throws an IllegalArgumentException.

Attributes

Source:
Attempt.scala

Converts to an either.

Converts to an either.

Attributes

Source:
Attempt.scala

Converts to an option, discarding the error value.

Converts to an option, discarding the error value.

Attributes

Source:
Attempt.scala
def toTry: Try[A]

Converts to a try.

Converts to a try.

Attributes

Source:
Attempt.scala

Concrete methods

True if attempt was not successful.

True if attempt was not successful.

Attributes

Source:
Attempt.scala

Inherited methods

def canEqual(that: Any): Boolean

Attributes

Inherited from:
Equals

Attributes

Inherited from:
Product
def productElement(n: Int): Any

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product