[Haskell-cafe] Re: Could someone teach me why we use Data.Monoid?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Fri Nov 13 12:31:32 EST 2009


It is a great example, shows both howto and benefits. Thanks.

2009/11/14 Maurí­cio CA <mauricio.antunes at gmail.com>:
>>  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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
竹密岂妨流水过
山高哪阻野云飞


More information about the Haskell-Cafe mailing list