{-# LANGUAGE CPP #-}
module Numeric.Product.Commutative
( CommutativeProduct (..)
)
where
import Control.Applicative (Const)
import Data.Complex (Complex)
import Data.Fixed
import Data.Functor.Identity
import Data.Int
import Data.Ratio (Ratio)
import Data.Word
import Numeric.Natural
#if MIN_VERSION_base(4, 9, 0)
import Data.Semigroup (Max, Min, Product, Sum)
#endif
#if MIN_VERSION_base(4, 11, 0)
import Data.Ord (Down)
#endif
#if MIN_VERSION_base(4, 12, 0)
import Data.Functor.Contravariant (Op)
import Data.Monoid (Alt)
#endif
class Num a => CommutativeProduct a
instance CommutativeProduct Int8
instance CommutativeProduct Int16
instance CommutativeProduct Int32
instance CommutativeProduct Int64
instance CommutativeProduct Int
instance CommutativeProduct Integer
instance CommutativeProduct Word8
instance CommutativeProduct Word16
instance CommutativeProduct Word32
instance CommutativeProduct Word64
instance CommutativeProduct Word
instance CommutativeProduct Natural
instance CommutativeProduct Float
instance CommutativeProduct Double
instance (RealFloat a, CommutativeProduct a) => CommutativeProduct (Complex a)
instance CommutativeProduct a => CommutativeProduct (Identity a)
instance CommutativeProduct a => CommutativeProduct (Sum a)
instance (Integral a, CommutativeProduct a) => CommutativeProduct (Ratio a)
instance (HasResolution a, CommutativeProduct a) => CommutativeProduct (Fixed a)
#if MIN_VERSION_base(4, 9, 0)
instance CommutativeProduct a => CommutativeProduct (Min a)
instance CommutativeProduct a => CommutativeProduct (Max a)
instance CommutativeProduct a => CommutativeProduct (Product a)
instance CommutativeProduct a => CommutativeProduct (Const a b)
#endif
#if MIN_VERSION_base(4, 11, 0)
instance CommutativeProduct a => CommutativeProduct (Down a)
#endif
#if MIN_VERSION_base(4, 12, 0)
instance CommutativeProduct a => CommutativeProduct (Op a b)
instance CommutativeProduct (f a) => CommutativeProduct (Alt f a)
#endif