RuleOps

final implicit class RuleOps[F[_], V[_], E](rule: Rule[F, V, E]) extends AnyVal
Source:
Rule.scala
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def effect: F[V[E]]

Alias for unwrap

Alias for unwrap

Source:
Rule.scala
def flatMap(f: V[E] => Rule[F, V, E])(implicit F: Effect[F], V: Validated[V]): Rule[F, V, E]

Combines rule and result of running f on rule using Rule.and. This is tricky syntax for usage with for-comprehension yield should always return valid Validated if you want this to work correctly.

Combines rule and result of running f on rule using Rule.and. This is tricky syntax for usage with for-comprehension yield should always return valid Validated if you want this to work correctly.

scala> import jap.fields._
scala> import jap.fields.DefaultAccumulateVM._
scala> val intF = Field(4)
val intF: jap.fields.Field[Int] = root:4
scala> for {
    |  _ <- intF > 4
    |  _ <- intF < 4
    |  _ <- intF !== 4
    | } yield V.valid
val res0:
 jap.fields.Rule[[A] =>> A, jap.fields.typeclass.Validated.Accumulate,
   jap.fields.ValidationError
 ] = Invalid(List(root -> must be greater than 4, root -> must be less than 4, root -> must not be equal to 4))
Source:
Rule.scala
def map(f: V[E] => V[E])(implicit F: Effect[F], V: Validated[V]): Rule[F, V, E]

Combines rule and result of running f on rule using Rule.and. This is tricky syntax for usage with for-comprehension. Check example in flatMap

Combines rule and result of running f on rule using Rule.and. This is tricky syntax for usage with for-comprehension. Check example in flatMap

Source:
Rule.scala
def mapK[FF[_]](f: F[V[E]] => FF[V[E]]): Rule[FF, V, E]
Source:
Rule.scala
def unwrap: F[V[E]]

Unwraps rule to its actual type

Unwraps rule to its actual type

Source:
Rule.scala