Witchcraft v0.5.0 Witchcraft.Monoid.Property

Check samples of your monoid to confirm that your data adheres to the monoidal properties. All members of your datatype should adhere to these rules. They are placed here as a quick way to spotcheck some of your values.

Summary

Functions

Spotcheck all monoid properties

Check that Monoid.append is associative (ie: brackets don’t matter)

Check that some member of your monoid combines with the identity to return itself

Functions

spotcheck(a, b, c)

Specs

spotcheck(any, any, any) :: boolean

Spotcheck all monoid properties

iex> spotcheck(1,2,3)
true
spotcheck_associativity(member1, member2, member3)

Specs

spotcheck_associativity(any, any, any) :: boolean

Check that Monoid.append is associative (ie: brackets don’t matter)

iex> spotcheck_associativity("a", "b", "c")
true
spotcheck_identity(member)

Specs

spotcheck_identity(any) :: boolean

Check that some member of your monoid combines with the identity to return itself

iex> spotcheck_identity("well formed")
true