Validated

cats.data.Validated
See theValidated companion class
object Validated

Attributes

Companion
class
Source
Validated.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Validated.type

Members list

Type members

Classlikes

final case class Invalid[+E](e: E) extends Validated[E, Nothing]

Attributes

Source
Validated.scala
Supertypes
class Validated[E, Nothing]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Valid[+A](a: A) extends Validated[Nothing, A]

Attributes

Source
Validated.scala
Supertypes
class Validated[Nothing, A]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
Source
Mirror.scala

The name of the type

The name of the type

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def catchOnly[T >: Null <: Throwable]: CatchOnlyPartiallyApplied[T]

Evaluates the specified block, catching exceptions of the specified type and returning them on the invalid side of the resulting Validated.

Evaluates the specified block, catching exceptions of the specified type and returning them on the invalid side of the resulting Validated. Uncaught exceptions are propagated.

For example:

scala> Validated.catchOnly[NumberFormatException] { "foo".toInt }
res0: Validated[NumberFormatException, Int] = Invalid(java.lang.NumberFormatException: For input string: "foo")

This method and its usage of NotNull are inspired by and derived from the fromTryCatchThrowable method contributed to Scalaz by Brian McKenna.

Attributes

Source
Validated.scala

Inherited methods

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
final def cond[E, A](test: Boolean, a: => A, e: => E): Validated[E, A]

If the condition is satisfied, return the given A as valid, otherwise return the given E as invalid.

If the condition is satisfied, return the given A as valid, otherwise return the given E as invalid.

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
final def condNec[A, B](test: Boolean, b: => B, a: => A): ValidatedNec[A, B]

If the condition is satisfied, return the given B as valid NEC, otherwise return the given A as invalid NEC.

If the condition is satisfied, return the given B as valid NEC, otherwise return the given A as invalid NEC.

Attributes

Inherited from:
ValidatedFunctionsBinCompat0 (hidden)
Source
Validated.scala
final def condNel[E, A](test: Boolean, a: => A, e: => E): ValidatedNel[E, A]

If the condition is satisfied, return the given A as valid NEL, otherwise return the given E as invalid NEL.

If the condition is satisfied, return the given A as valid NEL, otherwise return the given E as invalid NEL.

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def fromEither[A, B](e: Either[A, B]): Validated[A, B]

Converts an Either[A, B] to a Validated[A, B].

Converts an Either[A, B] to a Validated[A, B].

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def fromIor[A, B](ior: Ior[A, B]): Validated[A, B]

Converts an Ior[A, B] to a Validated[A, B].

Converts an Ior[A, B] to a Validated[A, B].

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def fromOption[A, B](o: Option[B], ifNone: => A): Validated[A, B]

Converts an Option[B] to a Validated[A, B], where the provided ifNone values is returned on the invalid of the Validated when the specified Option is None.

Converts an Option[B] to a Validated[A, B], where the provided ifNone values is returned on the invalid of the Validated when the specified Option is None.

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def fromTry[A](t: Try[A]): Validated[Throwable, A]

Converts a Try[A] to a Validated[Throwable, A].

Converts a Try[A] to a Validated[Throwable, A].

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def invalid[E, A](e: E): Validated[E, A]

Converts an E to a Validated[E, A].

Converts an E to a Validated[E, A].

For example:

scala> Validated.invalid[IllegalArgumentException, String](new IllegalArgumentException("Argument is nonzero"))
res0: Validated[IllegalArgumentException, String] = Invalid(java.lang.IllegalArgumentException: Argument is nonzero)

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def invalidNec[A, B](a: A): ValidatedNec[A, B]

Converts an A to a ValidatedNec[A, B].

Converts an A to a ValidatedNec[A, B].

For example:

scala> Validated.invalidNec[IllegalArgumentException, String](new IllegalArgumentException("Argument is nonzero"))
res0: ValidatedNec[IllegalArgumentException, String] = Invalid(Chain(java.lang.IllegalArgumentException: Argument is nonzero))

Attributes

Inherited from:
ValidatedFunctionsBinCompat0 (hidden)
Source
Validated.scala
def invalidNel[E, A](e: E): ValidatedNel[E, A]

Converts an E to a ValidatedNel[E, A].

Converts an E to a ValidatedNel[E, A].

For example:

scala> Validated.invalidNel[IllegalArgumentException, String](new IllegalArgumentException("Argument is nonzero"))
res0: ValidatedNel[IllegalArgumentException, String] = Invalid(NonEmptyList(java.lang.IllegalArgumentException: Argument is nonzero))

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
final def unit[E]: Validated[E, Unit]

Cached value of Valid(()) to avoid allocations for a common case.

Cached value of Valid(()) to avoid allocations for a common case.

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def valid[E, A](a: A): Validated[E, A]

Converts a A to a Validated[E, A].

Converts a A to a Validated[E, A].

For example:

scala> Validated.valid[IllegalArgumentException, String]("Hello world")
res0: Validated[IllegalArgumentException, String] = Valid(Hello world)

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala
def validNec[A, B](b: B): ValidatedNec[A, B]

Converts a B to a ValidatedNec[A, B].

Converts a B to a ValidatedNec[A, B].

For example:

scala> Validated.validNec[IllegalArgumentException, String]("Hello world")
res0: ValidatedNec[IllegalArgumentException, String] = Valid(Hello world)

Attributes

Inherited from:
ValidatedFunctionsBinCompat0 (hidden)
Source
Validated.scala
def validNel[E, A](a: A): ValidatedNel[E, A]

Converts a A to a ValidatedNel[E, A].

Converts a A to a ValidatedNel[E, A].

For example:

scala> Validated.validNel[IllegalArgumentException, String]("Hello world")
res0: ValidatedNel[IllegalArgumentException, String] = Valid(Hello world)

Attributes

Inherited from:
ValidatedFunctions (hidden)
Source
Validated.scala

Implicits

Inherited implicits

implicit def catsDataAlignForValidated[E : Semigroup]: Align[[_] =>> Validated[E, _$4]]

Attributes

Inherited from:
ValidatedInstances (hidden)
Source
Validated.scala
implicit def catsDataApplicativeErrorForValidated[E](implicit E: Semigroup[E]): ApplicativeError[[_] =>> Validated[E, _$9], E]

Attributes

Inherited from:
ValidatedInstances (hidden)
Source
Validated.scala
implicit def catsDataEqForValidated[A : Eq, B : Eq]: Eq[Validated[A, B]]

Attributes

Inherited from:
ValidatedInstances2 (hidden)
Source
Validated.scala
implicit def catsDataMonoidForValidated[A, B](implicit A: Semigroup[A], B: Monoid[B]): Monoid[Validated[A, B]]

Attributes

Inherited from:
ValidatedInstances (hidden)
Source
Validated.scala

Attributes

Inherited from:
ValidatedInstances (hidden)
Source
Validated.scala
implicit def catsDataSemigroupKForValidated[A](implicit A: Semigroup[A]): SemigroupK[[_] =>> Validated[A, _$2]]

Attributes

Inherited from:
ValidatedInstances (hidden)
Source
Validated.scala
implicit def catsDataShowForValidated[A : Show, B : Show]: Show[Validated[A, B]]

Attributes

Inherited from:
ValidatedInstances (hidden)
Source
Validated.scala
implicit def catsDataTraverseFunctorForValidated[E]: Traverse[[_] =>> Validated[E, _$17]]

Attributes

Inherited from:
ValidatedInstances2 (hidden)
Source
Validated.scala