groups- Haskell 98 groups

Safe HaskellSafe-Inferred




class Monoid m => Group m whereSource

A Group is a Monoid plus a function, invert, such that:

a <> invert a == mempty
invert a <> a == mempty


invert :: m -> mSource

pow :: Integral x => m -> x -> mSource

pow a n == a <> a <> ... <> a
 (n lots of a)

If n is negative, the result is inverted.


Group () 
Group a => Group (Dual a) 
Num a => Group (Sum a) 
Fractional a => Group (Product a) 
Group b => Group (a -> b) 
(Group a, Group b) => Group (a, b) 
(Group a, Group b, Group c) => Group (a, b, c) 
(Group a, Group b, Group c, Group d) => Group (a, b, c, d) 
(Group a, Group b, Group c, Group d, Group e) => Group (a, b, c, d, e) 

class Group g => Abelian g Source

An Abelian group is a Group that follows the rule:

a <> b == b <> a


Abelian () 
Abelian a => Abelian (Dual a) 
Num a => Abelian (Sum a) 
Fractional a => Abelian (Product a) 
Abelian b => Abelian (a -> b) 
(Abelian a, Abelian b) => Abelian (a, b) 
(Abelian a, Abelian b, Abelian c) => Abelian (a, b, c) 
(Abelian a, Abelian b, Abelian c, Abelian d) => Abelian (a, b, c, d) 
(Abelian a, Abelian b, Abelian c, Abelian d, Abelian e) => Abelian (a, b, c, d, e)