Maurí­cio CA | 13 Nov 18:15
Picon

Re: Could someone teach me why we use Data.Monoid?

>   I have looked the concept of monoid and something related, but
> still, I do not know why we use it?

I don't know if it's a good example, but it's simple. This
package I wrote uses reverse polish notation to write gtk2hs
layout windows.

http://hackage.haskell.org/package/gtk2hs-rpn

Since the type for operators used in the stack is a Monoid
instance, you can combine many of them to create new operators.

I believe you can think of monoids as things you can sequence
to make new ones of the same type, but someone with better
knowledge please say if this is actually a misleading idea.

Best,
Maurício

Gmane