Source

quickcheck-properties / Test / QuickCheck / Property / Monoid.hs

Full commit
-- | Properties for 'Monoid' type class
module Test.QuickCheck.Property.Monoid (
    module Test.QuickCheck.Property.Common
  , prop_MonoidLeft
  , prop_MonoidRight
  , prop_MonoidIdentity
  , prop_Mappend
  , prop_Monoid
  ) where

import Data.Monoid

import Test.QuickCheck.Property.Common
import Test.QuickCheck.Property.Common.Internal
import Test.QuickCheck.Property.Generic


-- | 'mempty' is left identity
prop_MonoidLeft :: Monoid a => T a -> a -> Equal a
prop_MonoidLeft = prop_LeftIdentity mempty mappend

-- | 'mempty' is right identity
prop_MonoidRight :: Monoid a => T a -> a -> Equal a
prop_MonoidRight = prop_RightIdentity mempty mappend

-- | 'mempty' is identity
prop_MonoidIdentity :: Monoid a => T a -> a -> Equal a
prop_MonoidIdentity = prop_Identity mempty mappend

-- | 'mappend' is associative
prop_Mappend :: Monoid a => T a -> a -> a -> a -> Equal a
prop_Mappend = prop_Associative mappend

-- | All properties of monoid
prop_Monoid :: Monoid a => T a -> a -> a -> a -> Equal a
prop_Monoid = prop_GenMonoid mempty mappend