EitherSyntax

Inspired from the cats (https://github.com/typelevel/cats project

class Object
trait Matchable
class Any
object syntax

Extensions

Extensions

extension [A, B](eab: Either[A, B])
def exists(f: B => Boolean): Boolean
def forall(f: B => Boolean): Boolean
def foreach(f: B => Unit): Unit
def toList: List[B]
def toOption: Option[B]
extension [A, B, C, D](eab: Either[A, B])
def bimap(fa: A => C, fb: B => D): Either[C, D]
extension [A, B, AA >: A, BB >: B, C](eab: Either[A, B])
def ap(that: Either[AA, BB => C]): Either[AA, C]
def append(that: Either[AA, BB])(using BB: Semigroup[BB]): Either[AA, BB]
def as(c: => C): Either[A, C]
def ensure(onFailure: => AA)(f: B => Boolean): Either[AA, B]
def flatMap(f: B => Either[AA, C]): Either[AA, C]
def foldLeft(c: C)(f: (C, B) => C): C
def getOrElse(default: => BB): BB
def leftMap(f: A => C): Either[C, B]
def map(f: B => C): Either[A, C]
def orElse(fallback: => Either[C, BB]): Either[C, BB]
def recover(pf: PartialFunction[A, BB]): Either[A, BB]
def recoverWith(pf: PartialFunction[A, Either[AA, BB]]): Either[AA, BB]
def show(using AA: Show[AA], BB: Show[BB]): String
def toTry(using ev: A <:< Throwable): Try[B]
def valueOr(f: A => BB): BB
extension [F[_], A, B, AA >: A, C](eab: Either[A, B])
def traverse(f: B => F[C])(using F: Applicative[F]): F[Either[AA, C]]