Class/Object

robots

PValidator

Related Docs: object PValidator | package robots

Permalink

final case class PValidator[F[_], E, A, B](validate: (A) ⇒ F[E], f: (A) ⇒ B)(implicit FF: Traverse[F], M: MonoidK[F]) extends Product with Serializable

PValidator wraps up a validation function validate: A => F[E] which validates the input A and returns a structure of error messages F[E].

The P in PValidator denotes the fact that this validation is polymorphic, in the sense that its input does not have to be of the same type as its output.

This may be useful when a successful validation provides some knowledge about the value that is being validated that can be used to refine its type.

For example, a required validator makes use of the fact that it has ensured that an Option[A] is not empty to safely unwrap the option's inner value.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PValidator
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PValidator(validate: (A) ⇒ F[E], f: (A) ⇒ B)(implicit FF: Traverse[F], M: MonoidK[F])

    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 all[C, X, Y](t: PTraversal[B, C, X, Y])(that: PValidator[F, E, X, Y]): PValidator[F, E, A, C]

    Permalink

    Combine this validator with a validator that which validates elements of a traversable structure extracted using the traversal t.

  5. def all[M[_], C](f: (A) ⇒ M[C])(that: PValidator[F, E, C, _])(implicit arg0: Traverse[M]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates elements of a traversable structure extracted using the function f.

  6. def all2[C, D](l: Lens[B, C], t: Traversal[B, D])(that: PValidator[F, E, (C, D), _]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates tuples of an inner value extracted using the lens l and elements of a traversable structure extracted using the traversal t.

  7. def all2[M[_], C, D](f: (A) ⇒ C, g: (A) ⇒ M[D])(that: PValidator[F, E, (C, D), _])(implicit TM: Traverse[M]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates tuples of a single inner value extracted using the function f and elements of a traversable structure extracted using the function g.

  8. def allIndexed[C, X, Y](t: PTraversal[B, C, (X, Int), Y])(that: PValidator[F, E, (X, Int), Y]): PValidator[F, E, A, C]

    Permalink

    Combine this validator with a validator that which validates tuples of elements and their indices in a traversable structure extracted using the traversal t.

  9. def allIndexed[M[_], C](g: (A) ⇒ M[C])(that: PValidator[F, E, (C, Int), _])(implicit TM: Traverse[M]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates tuples of elements and their indices in a traversable structure extracted using the function f.

  10. def and(that: PValidator[F, E, A, _]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with that to produce a validator which runs both validations.

    Combine this validator with that to produce a validator which runs both validations.

    This function ignores the post-processing step of the second validator that.

  11. def andThen[C](that: PValidator[F, E, B, C]): PValidator[F, E, A, C]

    Permalink

    Run this validation and then that validation on the input and if both pass, perform the post-processing of each validator in turn.

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def at[M[_], C](f: (A) ⇒ M[C], i: Long)(that: PValidator[F, E, Option[C], _])(implicit TM: Traverse[M]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates an optional value at index i of a traversable structure extracted using the function f.

  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def contramap[Z](g: (Z) ⇒ A): PValidator[F, E, Z, B]

    Permalink

    Adapt this validator to an input of type Z using the function g.

  16. def dimap[Z, C](g: (Z) ⇒ A)(h: (B) ⇒ C): PValidator[F, E, Z, C]

    Permalink

    Adapt this validator to an input of type Z using the function g and maps its output using h.

  17. def element[C, X](t: POptional[B, C, X, X])(that: PValidator[F, E, Option[X], _]): PValidator[F, E, A, C]

    Permalink

    Combine this validator with a validator that which validates an specific element of a traversable structure extracted using the traversal t

  18. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. val f: (A) ⇒ B

    Permalink
  20. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def first[M[_], C](f: (A) ⇒ M[C])(that: PValidator[F, E, Option[C], _])(implicit FM: Foldable[M]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates an optional value at the first index of a traversable structure extracted using the function f.

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

    Permalink
    Definition Classes
    AnyRef → Any
  23. def has[C, X, Y](l: PLens[B, C, X, Y])(that: PValidator[F, E, X, Y]): PValidator[F, E, A, C]

    Permalink

    Combine this validator with a validator that which validates an inner value extracted using the lens l.

  24. def has[C](f: (A) ⇒ C)(that: PValidator[F, E, C, _]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates an inner value extracted using the function f.

  25. def has2[X, Y](l: Lens[B, X], r: Lens[B, Y])(that: PValidator[F, E, (X, Y), _]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates a tuple of inner values extracted using the lenses l and r.

  26. def has2[C, D](f: (A) ⇒ C, g: (A) ⇒ D)(that: PValidator[F, E, (C, D), _]): PValidator[F, E, A, B]

    Permalink

    Combine this validator with a validator that which validates a tuple of inner values extracted using the functions f and g.

  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def leftMap[EE](g: (E) ⇒ EE): PValidator[F, EE, A, B]

    Permalink

    Transform any errors produced by this validator using the function g.

  29. def map[C](g: (B) ⇒ C): PValidator[F, E, A, C]

    Permalink

    Add an additional post-processing step g to the output value of this validator which is applied on success.

  30. def map2[C, D](that: PValidator[F, E, A, C])(g: (B, C) ⇒ D): PValidator[F, E, A, D]

    Permalink

    Combine this validator with that to produce a validator which runs both validations.

    Combine this validator with that to produce a validator which runs both validations. Use the function g to combine the post-processed values of both validators into a single value.

  31. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  34. def optional: PValidator[F, E, Option[A], Option[B]]

    Permalink

    Apply this validator to the inner value of an Option[A], passing when the Option is empty.

  35. def or[C](that: PValidator[F, E, C, B]): PValidator[F, E, Either[A, C], B]

    Permalink

    Combine this validator with that, a validator for a different type, to produce a validator for Either of this and that's validation.

  36. def over[M[_]](implicit TM: Traverse[M]): PValidator[F, E, M[A], M[B]]

    Permalink

    Extend this validator over an M[A] that is traversable so that every element is validated.

  37. def product[C](that: PValidator[F, E, A, C]): PValidator[F, E, A, (B, C)]

    Permalink

    Combine this validator with that to produce a validator which runs both validations.

    Combine this validator with that to produce a validator which runs both validations.

    This function runs the post-processing steps of both validators on the input and returns each of the results as a tuple.

  38. def required(e: F[E]): PValidator[F, E, Option[A], B]

    Permalink

    Apply this validator to the inner element of an Option[A], failing with error messages e when the Option is empty.

  39. def run[G[_]](a: A)(implicit A: ApplicativeError[G, F[E]]): G[B]

    Permalink

    A specialization of runWith which runs the validation on a and returns errors in the default error message structure F[E].

  40. def runK[G[_], H[_]](a: A)(g: ~>[F, H])(implicit A: ApplicativeError[G, H[E]]): G[B]

    Permalink

    A specialization of runWith which runs the validation on a and uses the natural transformation g to translate the error message structure F[E] into H[E].

  41. def runNel[G[_, _]](a: A)(implicit A: ApplicativeError[[β$0$]G[NonEmptyList[E], β$0$], NonEmptyList[E]]): G[NonEmptyList[E], B]

    Permalink

    A specialization of runWith which is designed for use with binary type constructors (e.g.

    A specialization of runWith which is designed for use with binary type constructors (e.g. Either, Validated). The error message type is NonEmptyList[E].

  42. def runWith[G[_], EE](a: A)(g: (F[E]) ⇒ EE)(implicit A: ApplicativeError[G, EE]): G[B]

    Permalink

    Runs the validation function.

    Runs the validation function. If the validation succeeds, the post-processing function of this validator f: A => B is used to transform the result value.

    Otherwise, the function g is used to convert the error message structure produced by the validation into the desired result EE.

    The function provided here is used to select the ApplicativeError instance that is used to lift pure values into G[_] and to raise errors EE.

  43. def run_[G[_]](a: A)(implicit A: ApplicativeError[G, Unit]): G[B]

    Permalink

    A specialization of runWith which runs the validation on a and uses a G[_] which returns no errors on failure, such as Option.

  44. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  45. val validate: (A) ⇒ F[E]

    Permalink
  46. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped