{-# language CPP #-}
{-# language FlexibleInstances #-}
{-# language Safe #-}
module Data.Group.Additive
(
AdditiveGroup
, (-)
, (+)
, (×)
, copower
, AdditiveAbelianGroup
) where
#if __GLASGOW_HASKELL__ > 804
import Data.Functor.Contravariant
#endif
import Data.Functor.Const
import Data.Functor.Identity
import Data.Group
import Data.Int
import Data.Ord
import Data.Proxy
import Data.Ratio
import Data.Semigroup
import Data.Word
import Prelude hiding ((-), (+))
infixl 6 -, +
infixl 7 ×
class Group g => AdditiveGroup g where
instance AdditiveGroup ()
instance AdditiveGroup b => AdditiveGroup (a -> b)
instance AdditiveGroup a => AdditiveGroup (Dual a)
instance AdditiveGroup a => AdditiveGroup (Down a)
instance AdditiveGroup Any
instance AdditiveGroup (Sum Integer)
instance AdditiveGroup (Sum Int)
instance AdditiveGroup (Sum Int8)
instance AdditiveGroup (Sum Int16)
instance AdditiveGroup (Sum Int32)
instance AdditiveGroup (Sum Int64)
instance AdditiveGroup (Sum Word)
instance AdditiveGroup (Sum Word8)
instance AdditiveGroup (Sum Word16)
instance AdditiveGroup (Sum Word32)
instance AdditiveGroup (Sum Word64)
instance AdditiveGroup (Sum (Ratio Integer))
instance AdditiveGroup (Sum (Ratio Int))
instance AdditiveGroup (Sum (Ratio Int8))
instance AdditiveGroup (Sum (Ratio Int16))
instance AdditiveGroup (Sum (Ratio Int32))
instance AdditiveGroup (Sum (Ratio Int64))
instance AdditiveGroup (Sum (Ratio Word))
instance AdditiveGroup (Sum (Ratio Word8))
instance AdditiveGroup (Sum (Ratio Word16))
instance AdditiveGroup (Sum (Ratio Word32))
instance AdditiveGroup (Sum (Ratio Word64))
instance (AdditiveGroup a, AdditiveGroup b) => AdditiveGroup (a,b)
instance (AdditiveGroup a, AdditiveGroup b, AdditiveGroup c) => AdditiveGroup (a,b,c)
instance (AdditiveGroup a, AdditiveGroup b, AdditiveGroup c, AdditiveGroup d) => AdditiveGroup (a,b,c,d)
instance (AdditiveGroup a, AdditiveGroup b, AdditiveGroup c, AdditiveGroup d, AdditiveGroup e) => AdditiveGroup (a,b,c,d,e)
instance AdditiveGroup a => AdditiveGroup (Const a b)
instance AdditiveGroup a => AdditiveGroup (Identity a)
instance AdditiveGroup a => AdditiveGroup (Proxy a)
instance AdditiveGroup a => AdditiveGroup (Endo a)
#if __GLASGOW_HASKELL__ > 804
instance AdditiveGroup a => AdditiveGroup (Op a b)
#endif
(-) :: AdditiveGroup a => a -> a -> a
(-) = a -> a -> a
forall a. Group a => a -> a -> a
minus
{-# inline (-) #-}
(×) :: (Integral n, AdditiveGroup a) => n -> a -> a
× :: n -> a -> a
(×) = n -> a -> a
forall n g. (Integral n, AdditiveGroup g) => n -> g -> g
copower
{-# inline (×) #-}
(+) :: AdditiveGroup g => g -> g -> g
+ :: g -> g -> g
(+) = g -> g -> g
forall a. Semigroup a => a -> a -> a
(<>)
{-# inline (+) #-}
copower :: (Integral n, AdditiveGroup g) => n -> g -> g
copower :: n -> g -> g
copower = n -> g -> g
forall a n. (Group a, Integral n) => n -> a -> a
gtimes
{-# inline copower #-}
class (AbelianGroup g, AdditiveGroup g) => AdditiveAbelianGroup g
instance AdditiveAbelianGroup ()
instance AdditiveAbelianGroup b => AdditiveAbelianGroup (a -> b)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Dual a)
instance AdditiveAbelianGroup Any
instance AdditiveAbelianGroup (Sum Integer)
instance AdditiveAbelianGroup (Sum Int)
instance AdditiveAbelianGroup (Sum Int8)
instance AdditiveAbelianGroup (Sum Int16)
instance AdditiveAbelianGroup (Sum Int32)
instance AdditiveAbelianGroup (Sum Int64)
instance AdditiveAbelianGroup (Sum Word)
instance AdditiveAbelianGroup (Sum Word8)
instance AdditiveAbelianGroup (Sum Word16)
instance AdditiveAbelianGroup (Sum Word32)
instance AdditiveAbelianGroup (Sum Word64)
instance AdditiveAbelianGroup (Sum (Ratio Integer))
instance AdditiveAbelianGroup (Sum (Ratio Int))
instance AdditiveAbelianGroup (Sum (Ratio Int8))
instance AdditiveAbelianGroup (Sum (Ratio Int16))
instance AdditiveAbelianGroup (Sum (Ratio Int32))
instance AdditiveAbelianGroup (Sum (Ratio Int64))
instance AdditiveAbelianGroup (Sum (Ratio Word))
instance AdditiveAbelianGroup (Sum (Ratio Word8))
instance AdditiveAbelianGroup (Sum (Ratio Word16))
instance AdditiveAbelianGroup (Sum (Ratio Word32))
instance AdditiveAbelianGroup (Sum (Ratio Word64))
instance (AdditiveAbelianGroup a, AdditiveAbelianGroup b) => AdditiveAbelianGroup (a,b)
instance (AdditiveAbelianGroup a, AdditiveAbelianGroup b, AdditiveAbelianGroup c) => AdditiveAbelianGroup (a,b,c)
instance (AdditiveAbelianGroup a, AdditiveAbelianGroup b, AdditiveAbelianGroup c, AdditiveAbelianGroup d) => AdditiveAbelianGroup (a,b,c,d)
instance (AdditiveAbelianGroup a, AdditiveAbelianGroup b, AdditiveAbelianGroup c, AdditiveAbelianGroup d, AdditiveAbelianGroup e) => AdditiveAbelianGroup (a,b,c,d,e)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Const a b)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Identity a)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Proxy a)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Down a)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Endo a)
#if __GLASGOW_HASKELL__ > 804
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Op a b)
#endif