FnWithFallback

final case class FnWithFallback[A, B](withFallback: (A => B) => A => B) extends AnyVal

A partial function that, given a fallback, can efficiently become a total function.

Companion:
object
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def embed(cond: A => Boolean, update: A => A): FnWithFallback[A, B]
def embed(f: A => Option[A]): FnWithFallback[A, B]
def mapWithInput[C](f: (A, B) => C)(implicit ev: Null <:< B): FnWithFallback[A, C]
def partial(implicit ev: Null <:< B): A => Option[B]
def when(cond: A => Boolean): FnWithFallback[A, B]
def withFallbackByName(b: => B): A => B
def withFallbackByNeed(b: B): A => B
def withFallbackByValue(b: B): A => B
def |(next: FnWithFallback[A, B]): FnWithFallback[A, B]

Attempt this partial function and if it doesn't produce a B, use the next argument. Like boolean OR, or Option#orElse.

Attempt this partial function and if it doesn't produce a B, use the next argument. Like boolean OR, or Option#orElse.

def |(next: Option[FnWithFallback[A, B]]): FnWithFallback[A, B]

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product