3 ms·
Not quite ;) Semigroups are defined by their associative, binary operator of type a -> a -> a. Monoids are that plus an identity value of a.
by whateveracct 11y ago
Not quite ;) Semigroups are defined by their associative, binary operator of type a -> a -> a. Monoids are that plus an identity value of a.
- skwosh 11y agoI think using Haskell's type syntax is misleading in this context (and doesn't really imply the required associativity (much less commutativity if you wanted to consider Abelian monoids)). The operation of a monoid maps from pairs of things to things. So in terms of types: <a,a> -> a Or for some `twin` type constructor: twin a -> a This is a bit more suggestive also in terms of F-algebras, where the operation has the following signature (f is a functor, or mappable container): f a -> a
- rarepostinlurkr 11y agoThere Haskell people go again =) You try to define something in simple normal terms, and off they go adding highly specific and technically correct words to what was supposed to be a simple explanation. (I'm not a Haskell expert, I dabble, done CIS194, half of RWH, and I have no idea what you said -- which is a common problem I run into in the Haskell world, lots of super helpful people that have forgotten what its like to not speak their language)