EMon

sealed
trait EMon[+A]

An Errors handling class. Consider changing name to EHan. The main ways to consume the final result of the flatMap operation are fold, getElse, foreach and forEither. This corresponds, but is not functionally equivalent to an Either[StrList, A] or Either[List[String], +A]. There are advantages to having a separate class and I find that I rarely use Either apart from with standard errors as the Left type. However use the methods biMap, to Either, eitherMap and eitherFlatMap when interoperability with Either is required. In my view Either[T] class is redundant and is rarely used except as an errors handler. So it makes sense to use a dedicated class.

Companion
object
class Object
trait Matchable
class Any
class Bad[A]
class Good[A]

Value members

Abstract methods

def biMap[L2, R2](fLeft: Strings => L2, fRight: A => R2): Either[L2, R2]

These are implemented in the base traits GoodBase[+A] and BadBase[+A] as Either[+A, +B] boxes all value classes.

These are implemented in the base traits GoodBase[+A] and BadBase[+A] as Either[+A, +B] boxes all value classes.

def flatMap[B](f: A => EMon[B]): EMon[B]
def flatMap2[B1, B2](f: A => EMon2[B1, B2]): EMon2[B1, B2]
def flatMap2ToOption[A2, B](o2: EMon[A2], f: (A, A2) => B): Option[B]
def flatMapToEither[D](f: A => Either[Strings, D]): Either[Strings, D]

These are implemented in the base traits GoodBase[+A] and BadBase[+A] as Either[+A, +B] boxes all value classes.

These are implemented in the base traits GoodBase[+A] and BadBase[+A] as Either[+A, +B] boxes all value classes.

def fld[B](noneValue: => B, fGood: A => B): B
def fold[B](noneValue: => B)(fGood: A => B): B
def foldDo(fGood: A => Unit)(fBad: Strings => 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 Good 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 Good classes to avoid boxing.

@inline
def foldErrs[B](fGood: A => B)(fBad: Strings => B): B

Fold the EMon of type A into a type of B.

Fold the EMon of type A into a type of B.

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

Will perform action if Good. Does nothing if Bad.

Will perform action if Good. Does nothing if Bad.

def get: A

Gets the value of Good, throws exception on Bad.

Gets the value of Good, throws exception on Bad.

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.

def isBad: Boolean
def isGood: Boolean
def map[B](f: A => B): EMon[B]
def mapToEither[D](f: A => D): Either[Strings, D]

Maps Good to Right[Strings, D] and Bad to Left[Strings, D]. These are implemented in the base traits GoodBase[+A] and BadBase[+A] as Either[+A, +B] boxes all value classes.

Maps Good to Right[Strings, D] and Bad to Left[Strings, D]. These are implemented in the base traits GoodBase[+A] and BadBase[+A] as Either[+A, +B] boxes all value classes.

def mapToOption[B](f: A => B): Option[B]
def toEither: Either[Strings, A]

Concrete methods

def findSetting[A](settingStr: String)(implicit ev: Persist[A]): EMon[A]
Implicitly added by EMonStringImplicit
def findSettingElse[A : Persist](settingStr: String, elseValue: => A): A
Implicitly added by EMonStringImplicit
def findSomeSetting[A : Persist](settingStr: String, elseValue: => A): A
Implicitly added by EMonStringImplicit
def findSomeSettingElse[A : Persist](settingStr: String, elseValue: => A): A
Implicitly added by EMonStringImplicit
def findType[A](implicit ev: Persist[A]): EMon[A]
Implicitly added by EMonStringImplicit
def findTypeElse[A : Persist](elseValue: => A): A
Implicitly added by EMonStringImplicit
def findTypeForeach[A : Persist](f: A => Unit): Unit
Implicitly added by EMonStringImplicit