FunLand.Semicombinable behaviour (fun_land v0.10.0)
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 ascombine(bowl_with_apples, combine(bowl_with_oranges, bowl_with_bananas)) ## Some Common Semigroups - Strings (binaries) - List Concatenation - Algebraic Addition - Algebraic Multiplication Many semicombinables are not only 'semi', but fully Combinable. (See the
Combinable` module) ## In Other Environments - In Category Theory, something that is Semicombinable is called a Semigroup.
Link to this section Summary
Link to this section Types
Link to this type
semicombinable(a)
Specs
semicombinable(a) :: FunLand.adt(a)
Link to this section Functions
Link to this function
combine(a, b)
Link to this section Callbacks
Link to this callback
semicombine(semicombinable, semicombinable)
Specs
semicombine(semicombinable(a), semicombinable(a)) :: semicombinable(a) when a: any()