{-# 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.Int
import Data.Proxy
import Data.Ratio
import Data.Semigroup
import Data.Word
import Numeric.Natural
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 MultiplicativeGroup All
instance MultiplicativeGroup (Product (Ratio Integer))
instance MultiplicativeGroup (Product (Ratio Natural))
instance MultiplicativeGroup (Product (Ratio Int))
instance MultiplicativeGroup (Product (Ratio Int8))
instance MultiplicativeGroup (Product (Ratio Int16))
instance MultiplicativeGroup (Product (Ratio Int32))
instance MultiplicativeGroup (Product (Ratio Int64))
instance MultiplicativeGroup (Product (Ratio Word))
instance MultiplicativeGroup (Product (Ratio Word8))
instance MultiplicativeGroup (Product (Ratio Word16))
instance MultiplicativeGroup (Product (Ratio Word32))
instance MultiplicativeGroup (Product (Ratio Word64))
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, AbelianGroup g) => MultiplicativeAbelianGroup g
instance MultiplicativeAbelianGroup ()
instance MultiplicativeAbelianGroup b => MultiplicativeAbelianGroup (a -> b)
instance MultiplicativeAbelianGroup a => MultiplicativeAbelianGroup (Dual a)
instance MultiplicativeAbelianGroup All
instance MultiplicativeAbelianGroup (Product (Ratio Integer))
instance MultiplicativeAbelianGroup (Product (Ratio Natural))
instance MultiplicativeAbelianGroup (Product (Ratio Int))
instance MultiplicativeAbelianGroup (Product (Ratio Int8))
instance MultiplicativeAbelianGroup (Product (Ratio Int16))
instance MultiplicativeAbelianGroup (Product (Ratio Int32))
instance MultiplicativeAbelianGroup (Product (Ratio Int64))
instance MultiplicativeAbelianGroup (Product (Ratio Word))
instance MultiplicativeAbelianGroup (Product (Ratio Word8))
instance MultiplicativeAbelianGroup (Product (Ratio Word16))
instance MultiplicativeAbelianGroup (Product (Ratio Word32))
instance MultiplicativeAbelianGroup (Product (Ratio Word64))
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)