View Source Witchcraft.Monoid (Witchcraft v1.0.6-doma)

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

type-class

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

Example

iex> empty(10)
0

iex> empty [1, 2, 3, 4, 5]
[]
@spec empty?(t()) :: boolean()

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

examples

Examples

iex> empty?([])
true

iex> empty?([1])
false

See Witchcraft.Monoid.empty/1.