fun_land v0.6.1 FunLand.Semicombinable behaviour

An operation is Semiombinable if you can combine two values using it, but there is no clearly defined neutral thing which you can combine with an element to obtain itself.

if there is a clearly definable neutral element, use FunLand.Combinable instead.

Fruit Salad Example

If you have one bowl with apples, and a second bowl with oranges, one can combine these, by putting the apples and the oranges in the same bowl.

This follows the Semicombinable law:

  • associativity: combine(combine(bowl_with_apples, bowl_with_oranges), bowl_with_bananas) results in the same bowl as `combine(bowl_with_apples, combine(bowl_with_oranges, bowl_with_bananas)) ## Some Common Semigroups - Strings (binaries) - List Concatenation - Algebraic Addition - Algebraic Multiplication ## In Other Environments - In Category Theory, something that is Semicombinable is called a Semigroup.

Summary

Types

Functions

combine(combinable_a, combinable_b)

Callbacks

combine(combinable, combinable)

Specs

combine(combinable(a), combinable(a)) :: combinable(a) when a: any