Haskell Language Monoid Collapsing a list of Monoids into a single value


Example

mconcat :: [a] -> a is another method of the Monoid typeclass:

ghci> mconcat [Sum 1, Sum 2, Sum 3]
Sum {getSum = 6}
ghci> mconcat ["concat", "enate"]
"concatenate"

Its default definition is mconcat = foldr mappend mempty.