
On Sun, Dec 05 2021 15:24, Adrian wrote:
I note that in the paper "Monoid: Theme and Variations" [Yorgey 2012], a monoid homomorphism is defined in a manner consistent with the definitions found in Algebra [Hungerford 74]:
That is definitely true, but we are not talking about monoid endomorphisms, we are talking about endomorphisms _over a set_ that happen to form a monoid. Endomorphisms over a monoid M certainly need to be compatible with the monoid structure on M, but this is orthogonal to the present question. When `Endo` talks about endomorphisms, it means endomorphisms over the type (think: the set) `a`. More specifically, for any set X we can talk about all functions f: X → X. These are called "endomorphisms" even though they are only functions, because that's exactly what a homomorphism of a set is. The point of `Endo` being in Data.Monoid is that function composition of endomorphisms forms a monoid (with the identity element being the identity morphism) regardless of the underlying structure—be that a set, a monoid, a group, ...