{-# 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.Proxy
import Data.Semigroup
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 Num a => AdditiveGroup (Sum a)
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)
#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 (Abelian g, AdditiveGroup g) => AdditiveAbelianGroup g
instance AdditiveAbelianGroup ()
instance AdditiveAbelianGroup b => AdditiveAbelianGroup (a -> b)
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Dual a)
instance Num a => AdditiveAbelianGroup (Sum a)
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)
#if __GLASGOW_HASKELL__ > 804
instance AdditiveAbelianGroup a => AdditiveAbelianGroup (Op a b)
#endif