The type lambda of the typeclass under tests. For
example when testing an instance of Covariant<Array<string>>
, Typeclass
would be the type lambda of the higher-kinded type Covariant
.
First underlying type for the typeclass tests.
second underlying type for the typeclass tests.
Third underlying type for the typeclass tests. Three is the maximum number of type parameters required by any predicate of the parameterized typeclass laws.
An arbitrary for the underlying type A
.
An arbitrary for the underlying type B
.
An arbitrary for the underlying type C
.
An equivalence for the underlying type A
.
An equivalence for the underlying type B
.
An equivalence for the underlying type C
.
The higher-kinded type Typeclass<F>
is the typeclass instance under test.
For example when testing the Monad
laws on an Either<number, string>
,
this would be Monad<Either>
.
A function that will get an arbitrary for the type under test from an arbitrary for the underlying type.
A function that will get an equivalence for the type under test from an equivalence for the underlying type.
Required Monoid
for the underlying type A
, useful for typeclasses
like Applicative
that can build their own Monoid
instance from it.
Predicate for values of type A
.
Predicate for values of type B
.
Predicate for values of type C
.
Unfolded requirements for testing parameterized typeclass laws. These are set as the union of all arguments required by the law predicates for parameterized typeclass laws.
For example, the field
aob
is required by the filterableLaws composition typeclass law, andbab
by * the the reduce law of foldableLaws.The nomenclature is based on the types of expressions, and is designed to make it easy, or at least easy as possible, for the author of law tests to find the correct arguments required by the predicates they are checking:
A
,B
, andC
are the underlying types. There are no predicates in any parameterized typeclass law that require more than three type parameters.a
,b
, andc
are the names of arbitraries for the three underlying types.fa
,fb
, andfc
, standing for arbitraries ofF<A>
,F<B>
, andF<C>
respectively.A ⇒ B
, we use the lower case type names of argument followed by return value. For example an arbitrary for a function of typeC ⇒ B
we use the field namecb
.(b: B, a: A) => B
will be calledbab
.endo[TYPE]
, for exampleendoA
is the name of an arbitrary a functionA ⇒ A
.f
. For example,afb
is an arbitrary for a function of the typeA ⇒ F<B>
, whereF
is the higher-kinded datatype under test.Option
data type are also named in this way, except thef
is replaced by ano
.aob
, for example, is the field where you will find an arbitrary function of typeA ⇒ Option<B>
.Applicative
laws, for example, require a function of the type:(of: <T>(a: T) => F<T>>) => Arbitrary<F<(a: A) => B>>>
. I.e.: a function tht takes a lifting function, and returns an arbitrary for the unary function(a: A) => B
. These are called just like the lifted function argument would have been called (afb
), but with anOf
suffix, and thef
is moved to the head position. The function above, for example, would be found in a field calledfabOf
.equalsA
,equalsB
, andequalsC
.equalsFa
,equalsFb
, andequalsFc
.predicateA
,predicateB
, andpredicateC
, for functions that take a value of the underlying type and returns a boolean.Having all given arguments for all predicates in a central place is less open-closed. We still do it though, as it massively simplifies the code unfolding law predicate arguments.
Type Param: F
The type lambda of the datatype under test. For example when testing an instance of
Covariant<Array<string>>
,F
would be the type lambda of the higher-kinded typeArray
.