From: Ross Paterson Date: Fri, 16 Jan 2009 15:16:24 +0000 (+0000) Subject: add Monoid laws X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=4d9023e9281493aea632196980543dfdedfd9910;p=ghc-base.git add Monoid laws --- diff --git a/Data/Monoid.hs b/Data/Monoid.hs index a0e3b20..65e3bb7 100644 --- a/Data/Monoid.hs +++ b/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'.