Result

object Result
Companion
class
trait Sum
trait Mirror
class Object
trait Matchable
class Any

Type members

Classlikes

case class Failure(log: List[Log]) extends Result
case object Success extends Result

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

Value members

Concrete methods

def all(l: List[Result]): Result
def any(l: List[Result]): Result
def assert(b: Boolean): Result
def diff[A, B](a: A, b: B)(f: (A, B) => Boolean): Result

Compare two arguments with the comparison function and return Result.success if the function return true. Otherwise, it returns Result.failure with the Log containing the argument values.

Compare two arguments with the comparison function and return Result.success if the function return true. Otherwise, it returns Result.failure with the Log containing the argument values.

See also
Example
 val a1 = "abc"
 val a2 = "abc"
 Result.diff(a1, a2)(_ == _)
 // Result.success
 Result.diff(123, 456)(_ != _).log("It must be different.")
 // Result.success
 val x = 'q'
 val y = 80
 Result.diff(x, y)((x, y) => y < 87 && x <= 'r')
 // Result.success
 val a1 = "abc"
 val a2 = "xyz"
 Result.diff(a1, a2)(_ == _)
 // Result.failure
 > === Failed ===
 > --- lhs ---
 > abc
 > --- rhs ---
 > xyz
 Result.diff(123, 123)(_ != _).log("It must be different.")
 // Result.failure
 > === Failed ===
 > --- lhs ---
 > 123
 > --- rhs ---
 > 123
 > It must be different.
 val x = 'z'
 val y = 100
 Result.diff(x, y)((x, y) => y < 87 && x <= 'r')
 // Result.failure
 > === Failed ===
 > --- lhs ---
 > z
 > --- rhs ---
 > 100
def diffNamed[A, B](logName: String, a: A, b: B)(f: (A, B) => Boolean): Result
def error(e: Exception): Result