Class

cats.data.Validated

Valid

Related Doc: package Validated

Permalink

final case class Valid[+A](a: A) extends Validated[Nothing, A] with Product with Serializable

Linear Supertypes
Validated[Nothing, A], Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Valid
  2. Validated
  3. Serializable
  4. Serializable
  5. Product
  6. Equals
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Valid(a: A)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def ===[EE >: Nothing, AA >: A](that: Validated[EE, AA])(implicit EE: Eq[EE], AA: Eq[AA]): Boolean

    Permalink
    Definition Classes
    Validated
  5. val a: A

    Permalink
  6. def andThen[EE >: Nothing, B](f: (A) ⇒ Validated[EE, B]): Validated[EE, B]

    Permalink

    Apply a function (that returns a Validated) in the valid case.

    Apply a function (that returns a Validated) in the valid case. Otherwise return the original Validated.

    This allows "chained" validation: the output of one validation can be fed into another validation function.

    This function is similar to flatMap on Either. It's not called flatMap, because by Cats convention, flatMap is a monadic bind that is consistent with ap. This method is not consistent with ap (or other Apply-based methods), because it has "fail-fast" behavior as opposed to accumulating validation failures.

    Definition Classes
    Validated
  7. def ap[EE >: Nothing, B](f: Validated[EE, (A) ⇒ B])(implicit EE: Semigroup[EE]): Validated[EE, B]

    Permalink

    From Apply: if both the function and this value are Valid, apply the function

    From Apply: if both the function and this value are Valid, apply the function

    Definition Classes
    Validated
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def bimap[EE, AA](fe: (Nothing) ⇒ EE, fa: (A) ⇒ AA): Validated[EE, AA]

    Permalink

    Validated is a functor.Bifunctor, this method applies one of the given functions.

    Validated is a functor.Bifunctor, this method applies one of the given functions.

    Definition Classes
    Validated
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def combine[EE >: Nothing, AA >: A](that: Validated[EE, AA])(implicit EE: Semigroup[EE], AA: Semigroup[AA]): Validated[EE, AA]

    Permalink

    Combine this Validated with another Validated, using the Semigroup instances of the underlying E and A instances.

    Combine this Validated with another Validated, using the Semigroup instances of the underlying E and A instances. The resultant Validated will be Valid, if, and only if, both this Validated instance and the supplied Validated instance are also Valid.

    Definition Classes
    Validated
  12. def compare[EE >: Nothing, AA >: A](that: Validated[EE, AA])(implicit EE: Order[EE], AA: Order[AA]): Int

    Permalink
    Definition Classes
    Validated
  13. def ensure[EE >: Nothing](onFailure: ⇒ EE)(f: (A) ⇒ Boolean): Validated[EE, A]

    Permalink

    Ensure that a successful result passes the given predicate, falling back to an Invalid of onFailure if the predicate returns false.

    Ensure that a successful result passes the given predicate, falling back to an Invalid of onFailure if the predicate returns false.

    For example:

    scala> Validated.valid("").ensure(new IllegalArgumentException("Must not be empty"))(_.nonEmpty)
    res0: Validated[IllegalArgumentException, String] = Invalid(java.lang.IllegalArgumentException: Must not be empty)
    Definition Classes
    Validated
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def exists(predicate: (A) ⇒ Boolean): Boolean

    Permalink

    Is this Valid and matching the given predicate

    Is this Valid and matching the given predicate

    Definition Classes
    Validated
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def fold[B](fe: (Nothing) ⇒ B, fa: (A) ⇒ B): B

    Permalink
    Definition Classes
    Validated
  18. def foldLeft[B](b: B)(f: (B, A) ⇒ B): B

    Permalink

    apply the given function to the value with the given B when valid, otherwise return the given B

    apply the given function to the value with the given B when valid, otherwise return the given B

    Definition Classes
    Validated
  19. def foldRight[B](lb: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B]): Eval[B]

    Permalink

    Lazily-apply the given function to the value with the given B when valid, otherwise return the given B.

    Lazily-apply the given function to the value with the given B when valid, otherwise return the given B.

    Definition Classes
    Validated
  20. def forall(f: (A) ⇒ Boolean): Boolean

    Permalink

    Is this Invalid or matching the predicate

    Is this Invalid or matching the predicate

    Definition Classes
    Validated
  21. def foreach(f: (A) ⇒ Unit): Unit

    Permalink

    Run the side-effecting function on the value if it is Valid

    Run the side-effecting function on the value if it is Valid

    Definition Classes
    Validated
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def getOrElse[B >: A](default: ⇒ B): B

    Permalink

    Return the Valid value, or the default if Invalid

    Return the Valid value, or the default if Invalid

    Definition Classes
    Validated
  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. def isInvalid: Boolean

    Permalink
    Definition Classes
    Validated
  26. def isValid: Boolean

    Permalink
    Definition Classes
    Validated
  27. def leftMap[EE](f: (Nothing) ⇒ EE): Validated[EE, A]

    Permalink

    Apply a function to an Invalid value, returning a new Invalid value.

    Apply a function to an Invalid value, returning a new Invalid value. Or, if the original valid was Valid, return it.

    Definition Classes
    Validated
  28. def map[B](f: (A) ⇒ B): Validated[Nothing, B]

    Permalink

    Apply a function to a Valid value, returning a new Valid value

    Apply a function to a Valid value, returning a new Valid value

    Definition Classes
    Validated
  29. def merge[EE >: Nothing](implicit ev: <:<[A, EE]): EE

    Permalink
    Definition Classes
    Validated
  30. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. def orElse[EE, AA >: A](default: ⇒ Validated[EE, AA]): Validated[EE, AA]

    Permalink

    Return this if it is Valid, or else fall back to the given default.

    Return this if it is Valid, or else fall back to the given default.

    Definition Classes
    Validated
  34. def partialCompare[EE >: Nothing, AA >: A](that: Validated[EE, AA])(implicit EE: PartialOrder[EE], AA: PartialOrder[AA]): Double

    Permalink
    Definition Classes
    Validated
  35. def product[EE >: Nothing, B](fb: Validated[EE, B])(implicit EE: Semigroup[EE]): Validated[EE, (A, B)]

    Permalink

    From Product

    From Product

    Definition Classes
    Validated
  36. def show[EE >: Nothing, AA >: A](implicit EE: Show[EE], AA: Show[AA]): String

    Permalink
    Definition Classes
    Validated
  37. def swap: Validated[A, Nothing]

    Permalink
    Definition Classes
    Validated
  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  39. def toEither: Either[Nothing, A]

    Permalink

    Converts the value to an Either[E, A]

    Converts the value to an Either[E, A]

    Definition Classes
    Validated
  40. def toList: List[A]

    Permalink

    Convert this value to a single element List if it is Valid, otherwise return an empty List

    Convert this value to a single element List if it is Valid, otherwise return an empty List

    Definition Classes
    Validated
  41. def toOption: Option[A]

    Permalink

    Returns Valid values wrapped in Some, and None for Invalid values

    Returns Valid values wrapped in Some, and None for Invalid values

    Definition Classes
    Validated
  42. def toValidatedNel[EE >: Nothing, AA >: A]: ValidatedNel[EE, AA]

    Permalink

    Lift the Invalid value into a NonEmptyList.

    Lift the Invalid value into a NonEmptyList.

    Definition Classes
    Validated
  43. def traverse[F[_], EE >: Nothing, B](f: (A) ⇒ F[B])(implicit F: Applicative[F]): F[Validated[EE, B]]

    Permalink

    When Valid, apply the function, marking the result as valid inside the Applicative's context, when Invalid, lift the Error into the Applicative's context

    When Valid, apply the function, marking the result as valid inside the Applicative's context, when Invalid, lift the Error into the Applicative's context

    Definition Classes
    Validated
  44. def valueOr[B >: A](f: (Nothing) ⇒ B): B

    Permalink

    Return the Valid value, or the result of f if Invalid

    Return the Valid value, or the result of f if Invalid

    Definition Classes
    Validated
  45. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. def withEither[EE, B](f: (Either[Nothing, A]) ⇒ Either[EE, B]): Validated[EE, B]

    Permalink

    Convert to an Either, apply a function, convert back.

    Convert to an Either, apply a function, convert back. This is handy when you want to use the Monadic properties of the Either type.

    Definition Classes
    Validated

Inherited from Validated[Nothing, A]

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped