monoid-owns-2010.5.29: a practical monoid implementation



class Monoid a whereSource


mempty :: aSource

Identity of mappend

mappend :: a -> a -> aSource

An associative operation

mconcat :: [a] -> aSource

Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.


Monoid Double 
Monoid Float 
Monoid Int 
Monoid Integer 
Monoid () 
Monoid ByteString 
Monoid ByteString 
Monoid [a] 
Monoid (Maybe a) 
Monoid (Seq a) 
Ord a => Monoid (Set a) 
Monoid b => Monoid (a -> b) 
(Monoid a, Monoid b) => Monoid (a, b) 
Ord a => Monoid (Map a b) 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) 
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) 

(+) :: Monoid a => a -> a -> aSource