Disclaimer: I don't really know all about category theory, so some definitions might not be absolutely correct.
Monoid is the category of all types that have a empty value and an append operation.
The best example is a list.
instance Monoid [a] where
mempty = []
mappend = (++)
instance Ord a => Monoid (Set a) whereHope I have helped!
mempty = empty
mappend = union
mconcat = unions
Hi,
I have looked the concept of monoid and something related, but
still, I do not know why we use it?
--
竹密岂妨流水过
山高哪阻野云飞
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe