trait Proposition[+E, -A] extends AnyRef
A data type for lazy consistency checks on a data structure.
A Proposition wraps a function that checks a proposition of a logical statement over a type. Combinators like leftMap, contramap, &&, ||, and not, can be used to easily create more complex checks.
val a = Proposition[String, Int](x => if(x > 10) False("age should be less than 10") else True) //a: purity.Proposition[String,Int] = Proposition a.check(21) //res0: purity.Truth[String] = False(NonEmptyList(age should be less than 10)) a.check(9) //res1: purity.Truth[String] = True val b = Proposition[String, String](x => if(x.length > 2) False("name code should be less than 3") else True) //b: purity.Proposition[String,String] = Proposition val c = a.contramap[User](_.age) && b.contramap[User](_.name) //c: purity.Proposition[String,User] = Proposition c.check(User("FAF", 21)) //res3: purity.Truth[String] = False(NonEmptyList(age should be less than 10, name code should be less than 3))
- E
type of the failure in case of an False result.
- A
type to be checked for consistency.
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- Proposition
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def &&[EE >: E, AA <: A](g: Proposition[EE, AA]): Proposition[EE, AA]
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def contramap[B](f: (B) ⇒ A): Proposition[E, B]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def leftMap[E2](f: (E) ⇒ E2): Proposition[E2, A]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def not[EE >: E](e: EE): Proposition[EE, A]
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def optional: Proposition[E, Option[A]]
- def required[EE >: E](e: EE): Proposition[EE, Option[A]]
- def script[F[+_], E2](dsl: ScriptDsl[F])(a: A)(implicit ev: Applicative[F]): Independent[NonEmptyList[E], Unit]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Proposition → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def ||[EE >: E, AA <: A](g: Proposition[EE, AA]): Proposition[EE, AA]