Witchcraft v0.3.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
apply composes normally
Being an applicative functor, apply behaves as lift on wrapped values
applying a wrapped function to a wrapped value is the same as wrapping the
result of the function on that value
applying a lifted id to some lifted value v does not change v
The order does not matter when applying to a wrapped value
and a wrapped function
Functions
Specs
spotcheck_composition(any, any, any) :: boolean
apply composes normally.
iex> spotcheck_composition([1, 2], [&(&1 * 2)], [&(&1 * 10)]) true
Specs
spotcheck_functor(any, (... -> any)) :: boolean
Being an applicative functor, apply behaves as lift on wrapped values
iex> spotcheck_functor([1,2,3], &(&1 * 10))
true
iex> spotcheck_functor(%Witchcraft.Id{id: 7}, &(&1 * 99))
true
Specs
spotcheck_homomorphism(any, any, (... -> any)) :: boolean
applying a wrapped function to a wrapped value is the same as wrapping the
result of the function on that value.
iex> spotcheck_homomorphism([], 1, &(&1 * 10))
true
Specs
spotcheck_identity(any) :: boolean
applying a lifted id to some lifted value v does not change v
iex> spotcheck_identity []
true
iex> spotcheck_identity %Witchcraft.Id{}
true