[Haskell-cafe] Could someone teach me why we use Data.Monoid?
Stephen Tetley
stephen.tetley at gmail.com
Fri Nov 13 14:44:00 EST 2009
Hi Edward
Many thanks.
I've mostly used groupoid for 'string concatenation' on types that I
don't consider to have useful empty (e.g PostScript paths, bars of
music...), as string concatenation is associative it would have been
better if I'd used semigroup in the first place (bounding box union
certainly looks associative to me as well).
Are magma and semigroup exclusive, i.e. in the presence of both a
Magma class and a Semigroup class would it be correct that Magma
represents only 'magma-op' where op isn't associative and Semigroup
represents 'semigroup-op' where the op is associative?
When I decided to use a Groupoid class, I was being a bit lazy-minded
and felt it could represent a general binary op that _doesn't have to
be_ associative but potentially could be.
Thanks again
Stephen
2009/11/13 Edward Kmett <ekmett at gmail.com>:
>
>
>
>
> Watch out, in more common parlance, having just an binary operation is a
> magma, while having a category with full inverses yields a groupoid. I
> haven't seen many people use the older groupoid term for magmas, if only
> because they started to have naming conflicts with the category theory
> people, and Bourbaki's 'magma' was available and unambiguous. =)
>
> And of course magma is not to be confused with the notion of a semigroup,
> which is a binary associative operation, and is therefore much more similar
> to a monoid in that all it lacks is a unit.
>
> -Edward Kmett
>
More information about the Haskell-Cafe
mailing list