Witchcraft v0.5.0 Witchcraft.Applicative.Property

Check samples of your applicative functor to confirm that your data adheres to the applicative properties. All members of your datatype should adhere to these rules, plus implement Witchcraft.Functor.

They are placed here as a quick way to spotcheck some of your values.

Summary

Functions

Being an applicative functor, seq behaves as lift on wrapped values

seqing a wrapped function to a wrapped value is the same as wrapping the result of the function on that value

seqing a lifted id to some lifted value v does not change v

The order does not matter when seqing to a wrapped value and a wrapped function

Functions

spotcheck_composition(value, fun1, fun2)

Specs

spotcheck_composition(any, any, any) :: boolean

seq composes normally.

Examples

iex> spotcheck_composition([1, 2], [&(&1 * 2)], [&(&1 * 10)])
true
spotcheck_functor(wrapped_value, fun)

Specs

spotcheck_functor(any, (... -> any)) :: boolean

Being an applicative functor, seq behaves as lift on wrapped values

Examples

iex> spotcheck_functor([1,2,3], &(&1 * 10))
true
spotcheck_homomorphism(specemin, val, fun)

Specs

spotcheck_homomorphism(any, any, (... -> any)) :: boolean

seqing a wrapped function to a wrapped value is the same as wrapping the result of the function on that value.

Examples

iex> spotcheck_homomorphism([], 1, &(&1 * 10))
true
spotcheck_identity(value)

Specs

spotcheck_identity(any) :: boolean

seqing a lifted id to some lifted value v does not change v

Examples

iex> spotcheck_identity []
true
spotcheck_interchange(bare_val, wrapped_fun)

Specs

spotcheck_interchange(any, any) :: boolean

The order does not matter when seqing to a wrapped value and a wrapped function.

Examples

iex> spotcheck_interchange(1, [&(&1 * 10)])
true