{-# language FlexibleInstances #-}
{-# language Safe #-}
module Data.Group.Multiplicative
(
MultiplicativeGroup
, (/)
, (*)
, (^)
, power
, MultiplicativeAbelianGroup
) where
import Data.Functor.Const
import Data.Functor.Identity
import Data.Group
import Data.Proxy
import Data.Semigroup
import Prelude hiding ((^), (/), (*))
infixl 7 /, *
infixr 8 ^
class Group g => MultiplicativeGroup g
instance MultiplicativeGroup ()
instance MultiplicativeGroup b => MultiplicativeGroup (a -> b)
instance MultiplicativeGroup a => MultiplicativeGroup (Dual a)
instance Fractional a => MultiplicativeGroup (Product a)
instance (MultiplicativeGroup a, MultiplicativeGroup b) => MultiplicativeGroup (a,b)
instance (MultiplicativeGroup a, MultiplicativeGroup b, MultiplicativeGroup c) => MultiplicativeGroup (a,b,c)
instance (MultiplicativeGroup a, MultiplicativeGroup b, MultiplicativeGroup c, MultiplicativeGroup d) => MultiplicativeGroup (a,b,c,d)
instance (MultiplicativeGroup a, MultiplicativeGroup b, MultiplicativeGroup c, MultiplicativeGroup d, MultiplicativeGroup e) => MultiplicativeGroup (a,b,c,d,e)
instance MultiplicativeGroup a => MultiplicativeGroup (Const a b)
instance MultiplicativeGroup a => MultiplicativeGroup (Identity a)
instance MultiplicativeGroup a => MultiplicativeGroup (Proxy a)
(/) :: MultiplicativeGroup a => a -> a -> a
/ :: a -> a -> a
(/) = a -> a -> a
forall a. Group a => a -> a -> a
minus
{-# inline (/) #-}
(*) :: MultiplicativeGroup g => g -> g -> g
* :: g -> g -> g
(*) = g -> g -> g
forall a. Semigroup a => a -> a -> a
(<>)
{-# inline (*) #-}
(^) :: (Integral n, MultiplicativeGroup a) => a -> n -> a
^ :: a -> n -> a
(^) = a -> n -> a
forall n g. (Integral n, MultiplicativeGroup g) => g -> n -> g
power
{-# inline (^) #-}
power :: (Integral n, MultiplicativeGroup g) => g -> n -> g
power :: g -> n -> g
power g
a n
n = n -> g -> g
forall a n. (Group a, Integral n) => n -> a -> a
gtimes n
n g
a
{-# inline power #-}
class (MultiplicativeGroup g, Abelian g) => MultiplicativeAbelianGroup g
instance MultiplicativeAbelianGroup ()
instance MultiplicativeAbelianGroup b => MultiplicativeAbelianGroup (a -> b)
instance MultiplicativeAbelianGroup a => MultiplicativeAbelianGroup (Dual a)
instance Fractional a => MultiplicativeAbelianGroup (Product a)
instance (MultiplicativeAbelianGroup a, MultiplicativeAbelianGroup b) => MultiplicativeAbelianGroup (a,b)
instance (MultiplicativeAbelianGroup a, MultiplicativeAbelianGroup b, MultiplicativeAbelianGroup c) => MultiplicativeAbelianGroup (a,b,c)
instance (MultiplicativeAbelianGroup a, MultiplicativeAbelianGroup b, MultiplicativeAbelianGroup c, MultiplicativeAbelianGroup d) => MultiplicativeAbelianGroup (a,b,c,d)
instance (MultiplicativeAbelianGroup a, MultiplicativeAbelianGroup b, MultiplicativeAbelianGroup c, MultiplicativeAbelianGroup d, MultiplicativeAbelianGroup e) => MultiplicativeAbelianGroup (a,b,c,d,e)
instance MultiplicativeAbelianGroup a => MultiplicativeAbelianGroup (Const a b)
instance MultiplicativeAbelianGroup a => MultiplicativeAbelianGroup (Identity a)
instance MultiplicativeAbelianGroup a => MultiplicativeAbelianGroup (Proxy a)