-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Haskell 98 groups
--   
--   Haskell 98 groups. A group is a monoid with invertibility.
@package groups
@version 0.4.0.0

module Data.Group

-- | A Group is a Monoid plus a function, invert, such
--   that:
--   
--   
--   a <> invert a == mempty
--   
--   
--   
--   invert a <> a == mempty
--   
class Monoid m => Group m where pow x0 n0 = case compare n0 0 of { LT -> invert . f x0 $ negate n0 EQ -> mempty GT -> f x0 n0 } where f x n | even n = f (x `mappend` x) (n `quot` 2) | n == 1 = x | otherwise = g (x `mappend` x) ((n - 1) `quot` 2) x g x n c | even n = g (x `mappend` x) (n `quot` 2) c | n == 1 = x `mappend` c | otherwise = g (x `mappend` x) ((n - 1) `quot` 2) (x `mappend` c)
invert :: Group m => m -> m
pow :: (Group m, Integral x) => m -> x -> m

-- | An Abelian group is a Group that follows the rule:
--   
--   
--   a <> b == b <> a
--   
class Group g => Abelian g
instance (Abelian a, Abelian b, Abelian c, Abelian d, Abelian e) => Abelian (a, b, c, d, e)
instance (Abelian a, Abelian b, Abelian c, Abelian d) => Abelian (a, b, c, d)
instance (Abelian a, Abelian b, Abelian c) => Abelian (a, b, c)
instance (Abelian a, Abelian b) => Abelian (a, b)
instance Abelian b => Abelian (a -> b)
instance Abelian a => Abelian (Dual a)
instance Fractional a => Abelian (Product a)
instance Num a => Abelian (Sum a)
instance Abelian ()
instance (Group a, Group b, Group c, Group d, Group e) => Group (a, b, c, d, e)
instance (Group a, Group b, Group c, Group d) => Group (a, b, c, d)
instance (Group a, Group b, Group c) => Group (a, b, c)
instance (Group a, Group b) => Group (a, b)
instance Group b => Group (a -> b)
instance Group a => Group (Dual a)
instance Fractional a => Group (Product a)
instance Num a => Group (Sum a)
instance Group ()
