Witchcraft.Monoid (Witchcraft v1.0.3) View Source

Monoid extends the semigroup with the concept of an "empty" or "zero" element.

Type Class

An instance of Witchcraft.Monoid must also implement Witchcraft.Semigroup, and define Witchcraft.Monoid.empty/1.

Semigroup  [append/2]
    
 Monoid    [empty/1]

Link to this section Summary

Functions

An "emptied out" or "starting position" of the passed data.

Check if a value is the empty element of that type.

Link to this section Types

Link to this section Functions

An "emptied out" or "starting position" of the passed data.

Example

iex> empty(10)
0

iex> empty [1, 2, 3, 4, 5]
[]

Specs

empty?(t()) :: boolean()

Check if a value is the empty element of that type.

Examples

iex> empty?([])
true

iex> empty?([1])
false

See Witchcraft.Monoid.empty/1.