1 -----------------------------------------------------------------------------
3 -- Module : Control.Monad.Monoid
4 -- Copyright : (c) Andy Gill 2001,
5 -- (c) Oregon Graduate Institute of Science and Technology, 2001
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : non-portable ( requires mulit-parameter type classes )
12 -- Declaration of the Monoid class,and instances for list and functions
14 -- Inspired by the paper
15 -- /Functional Programming with Overloading and
16 -- Higher-Order Polymorphism/,
17 -- Mark P Jones (<http://www.cse.ogi.edu/~mpj>)
18 -- Advanced School of Functional Programming, 1995.
19 -----------------------------------------------------------------------------
21 module Control.Monad.Monoid (
27 -- ---------------------------------------------------------------------------
32 mappend :: a -> a -> a
35 -- Now the default for mconcat. For most types, this
36 -- default will be used, but is included in the class definition so
37 -- that optimized version of mconcat can be provided
38 -- for specific types.
40 mconcat = foldr mappend mempty
44 instance Monoid [a] where
48 instance Monoid (a -> a) where
52 instance Monoid () where
53 -- Should it be strict?