summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Monoid.hs
diff options
context:
space:
mode:
authorRoss Paterson <ross@soi.city.ac.uk>2009-01-16 15:16:24 +0000
committerRoss Paterson <ross@soi.city.ac.uk>2009-01-16 15:16:24 +0000
commited1a8c2e37d94fa6677f10cb7dcc2c348ce9c0bb (patch)
tree504bf904b47cce729e9d25e88c1440991b75ee4d /libraries/base/Data/Monoid.hs
parentd49ea2e7f573aaae379e434c52df429651bd3ff4 (diff)
downloadhaskell-ed1a8c2e37d94fa6677f10cb7dcc2c348ce9c0bb.tar.gz
add Monoid laws
Diffstat (limited to 'libraries/base/Data/Monoid.hs')
-rw-r--r--libraries/base/Data/Monoid.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs
index a0e3b20eff..65e3bb76d7 100644
--- a/libraries/base/Data/Monoid.hs
+++ b/libraries/base/Data/Monoid.hs
@@ -40,7 +40,17 @@ import Test.QuickCheck
-- ---------------------------------------------------------------------------
-- | The class of monoids (types with an associative binary operation that
--- has an identity). The method names refer to the monoid of lists,
+-- has an identity). Instances should satisfy the following laws:
+--
+-- * @mempty `mappend` x = x@
+--
+-- * @x `mappend` mempty = x@
+--
+-- * @x `mappend` (y `mappend` z) = (x `mappend` y) `mappend` z@
+--
+-- * @mconcat = 'foldr' mappend mempty@
+--
+-- The method names refer to the monoid of lists under concatenation,
-- but there are many other instances.
--
-- Minimal complete definition: 'mempty' and 'mappend'.