ErrBi

ostrat.ErrBi
See theErrBi companion object
sealed trait ErrBi[+E <: Throwable, +A]

Biased bifunctor for errors.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Fail[E]
object FailNotFound
object FailWrongType
class Succ[A]
Show all

Members list

Value members

Abstract methods

def flatMap[EE >: E <: Throwable, B](f: A => ErrBi[EE, B]): ErrBi[EE, B]

Classic flatMap function as we see on a Scala Option.

Classic flatMap function as we see on a Scala Option.

Attributes

def flatMapAcc[EE >: E <: Throwable, B](f: A => ErrBiAcc[EE, B])(using ctE: ClassTag[EE], ctB: ClassTag[B]): ErrBiAcc[EE, B]

If this ErrBi is a Succ produce and ErrBi accumulator with the parameter function.

If this ErrBi is a Succ produce and ErrBi accumulator with the parameter function.

Attributes

def fld[B](fFail: E => B, fSucc: A => B): B

Alternative fold, that only takes one parameter list. this ErrBi into a type B. Takes two function parameters, one converts from A to B as in a normal map method. The second parameter in its own parameter list converts from the Error type to type B.

Alternative fold, that only takes one parameter list. this ErrBi into a type B. Takes two function parameters, one converts from A to B as in a normal map method. The second parameter in its own parameter list converts from the Error type to type B.

Attributes

def fold[B](fFail: E => B)(fSucc: A => B): B

Fold this ErrBi into a type B. Takes two function parameters, one converts from A to B as in a normal map method. The second parameter in its own parameter list converts from the Error type to type B.

Fold this ErrBi into a type B. Takes two function parameters, one converts from A to B as in a normal map method. The second parameter in its own parameter list converts from the Error type to type B.

Attributes

def forFld(fErr: E => Unit, fSucc: A => Unit): Unit

This is just a Unit returning fold, but is preferred because the method is explicit that it is called for effects, rather than to return a value. This method is implemented in the leaf Succ and Fail classes to avoid boxing.

This is just a Unit returning fold, but is preferred because the method is explicit that it is called for effects, rather than to return a value. This method is implemented in the leaf Succ and Fail classes to avoid boxing.

Attributes

def forFold(fErr: E => Unit)(fSucc: A => Unit): Unit

This is just a Unit returning fold, but is preferred because the method is explicit that it is called for effects, rather than to return a value. This method is implemented in the leaf Succ and Fail classes to avoid boxing.

This is just a Unit returning fold, but is preferred because the method is explicit that it is called for effects, rather than to return a value. This method is implemented in the leaf Succ and Fail classes to avoid boxing.

Attributes

def forSucc(f: A => Unit): Unit

Will perform action if success. Does nothing if Fail.

Will perform action if success. Does nothing if Fail.

Attributes

True if this is a fail error.

True if this is a fail error.

Attributes

True if this is a successful Succ value.

True if this is a successful Succ value.

Attributes

def map[B](f: A => B): ErrBi[E, B]

Classic map function as we see on a Scala Option or List.

Classic map function as we see on a Scala Option or List.

Attributes

def succOrOther[EE >: E <: Throwable, AA >: A](otherErrBi: => ErrBi[EE, AA]): ErrBi[EE, AA]

Returns this if success, else returns the other ErrBi.

Returns this if success, else returns the other ErrBi.

Attributes

Concrete methods

def findSetting[A](settingStr: String)(using ev: Unshow[A]): ErrBi[Throwable, A]
Extension method from ErrBi
def findSettingElse[A : Unshow](settingStr: String, elseValue: => A): A
Extension method from ErrBi
def findSomeSetting[A : Unshow](settingStr: String, elseValue: => A): A
Extension method from ErrBi
def findSomeSettingElse[A : Unshow](settingStr: String, elseValue: => A): A
Extension method from ErrBi
def findType[A](using ev: Unshow[A]): ErrBi[Throwable, A]
Extension method from ErrBi

Extension method to map this ErrBi String to find a value of the given type from the String parsed as RSON.

Extension method to map this ErrBi String to find a value of the given type from the String parsed as RSON.

Attributes

def findTypeElse[A](elseValue: => A)(using ev: Unshow[A]): A
Extension method from ErrBi

Extension method to map this ErrBi String to find a value of the given type from the String parsed as RSON or return the elseValue if that fails.

Extension method to map this ErrBi String to find a value of the given type from the String parsed as RSON or return the elseValue if that fails.

Attributes

def findTypeForeach[A : Unshow](f: A => Unit): Unit
Extension method from ErrBi

Extension method to map this ErrBi String to find a value of the given type from the String parsed as RSON and then perform a foreach on the value if successful.

Extension method to map this ErrBi String to find a value of the given type from the String parsed as RSON and then perform a foreach on the value if successful.

Attributes

def flatOptMap[B](f: A => Option[B]): ErrBi[E | ExcNFT, B]

Classic flatMap function taking a function from A => Option[B] rather than the standard ErrBi of B.

Classic flatMap function taking a function from A => Option[B] rather than the standard ErrBi of B.

Attributes

def get: A
final def getElse(elseValue: A): A

Gets the value of Good or returns the elseValue parameter if Bad. Both Good and Bad should be implemented in the leaf classes to avoid unnecessary boxing of primitive values.

Gets the value of Good or returns the elseValue parameter if Bad. Both Good and Bad should be implemented in the leaf classes to avoid unnecessary boxing of primitive values.

Attributes

def orElse[E2 <: Throwable](elseVal: => ErrBi[E2, A]): ErrBi[E2, A]

Returns this ErrBi if it is a Succ else returns the parameter ErrBi, which may be a Succ or Fail.

Returns this ErrBi if it is a Succ else returns the parameter ErrBi, which may be a Succ or Fail.

Attributes