Exactly right, but for omitting associativity (which, as noted elsewhere, mightybyte skipped).
Re:Haskell People
by mightybyte on Saturday September 30, 2017 @03:39PM
(#15374660)
Yep, it sounds like you pretty much have it. In addition to the two examples you mention, here are some other examples of monoids:
Lists under concatenation Booleans under AND Booleans under OR Numbers under max Numbers under min
Function of arity-2 (possibly expressed as an infix operator)
Which is closed over the set of values that are its arguments/parameters
For a domain (set of input values) which contains a value that converts the function into an identity function when used.
E.g. -
Addition over real numbers (or integers...), becomes an identity function when one arg is 0
Multiplication over real numbers (or integers...), becomes an identity function when one arg is 1
Something along that line?
I guess that makes it useful for a fold/reduce type function where the final result is the same type as the input stream, and the initial value can be identified as a known default.