{-# language CPP #-}
{-# language FlexibleInstances #-}
{-# language Safe #-}
module Data.Group.Finite
(
FiniteGroup
, safeOrder
, FiniteAbelianGroup
) where
import Data.Functor.Const
import Data.Functor.Identity
import Data.Group
import Data.Int
import Data.Monoid
#if __GLASGOW_HASKELL__ >= 810
import Data.Ord
#endif
import Data.Proxy
import Data.Word
class (Group g, Bounded g) => FiniteGroup g where
instance FiniteGroup ()
instance FiniteGroup a => FiniteGroup (Dual a)
instance FiniteGroup a => FiniteGroup (Const a b)
instance FiniteGroup a => FiniteGroup (Identity a)
instance FiniteGroup a => FiniteGroup (Proxy a)
instance (FiniteGroup a, FiniteGroup b) => FiniteGroup (a,b)
instance (FiniteGroup a, FiniteGroup b, FiniteGroup c) => FiniteGroup (a,b,c)
instance (FiniteGroup a, FiniteGroup b, FiniteGroup c, FiniteGroup d) => FiniteGroup (a,b,c,d)
instance (FiniteGroup a, FiniteGroup b, FiniteGroup c, FiniteGroup d, FiniteGroup e) => FiniteGroup (a,b,c,d,e)
instance FiniteGroup Any
instance FiniteGroup All
instance FiniteGroup (Sum Int)
instance FiniteGroup (Sum Int8)
instance FiniteGroup (Sum Int16)
instance FiniteGroup (Sum Int32)
instance FiniteGroup (Sum Int64)
instance FiniteGroup (Sum Word)
instance FiniteGroup (Sum Word8)
instance FiniteGroup (Sum Word16)
instance FiniteGroup (Sum Word32)
instance FiniteGroup (Sum Word64)
instance FiniteGroup Ordering
#if __GLASGOW_HASKELL__ >= 810
instance FiniteGroup a => FiniteGroup (Down a)
#endif
safeOrder :: (Eq g, FiniteGroup g) => g -> Order
safeOrder :: g -> Order
safeOrder = g -> Order
forall g. (Eq g, Group g) => g -> Order
order
{-# inline safeOrder #-}
class FiniteGroup g => FiniteAbelianGroup g
instance FiniteAbelianGroup ()
instance FiniteAbelianGroup a => FiniteAbelianGroup (Dual a)
instance FiniteAbelianGroup (Sum Int)
instance FiniteAbelianGroup (Sum Int8)
instance FiniteAbelianGroup (Sum Int16)
instance FiniteAbelianGroup (Sum Int32)
instance FiniteAbelianGroup (Sum Int64)
instance FiniteAbelianGroup (Sum Word)
instance FiniteAbelianGroup (Sum Word8)
instance FiniteAbelianGroup (Sum Word16)
instance FiniteAbelianGroup (Sum Word32)
instance FiniteAbelianGroup (Sum Word64)
instance FiniteAbelianGroup a => FiniteAbelianGroup (Const a b)
instance FiniteAbelianGroup a => FiniteAbelianGroup (Identity a)
instance FiniteAbelianGroup a => FiniteAbelianGroup (Proxy a)
instance (FiniteAbelianGroup a, FiniteAbelianGroup b) => FiniteAbelianGroup (a,b)
instance (FiniteAbelianGroup a, FiniteAbelianGroup b, FiniteAbelianGroup c) => FiniteAbelianGroup (a,b,c)
instance (FiniteAbelianGroup a, FiniteAbelianGroup b, FiniteAbelianGroup c, FiniteAbelianGroup d) => FiniteAbelianGroup (a,b,c,d)
instance (FiniteAbelianGroup a, FiniteAbelianGroup b, FiniteAbelianGroup c, FiniteAbelianGroup d, FiniteAbelianGroup e) => FiniteAbelianGroup (a,b,c,d,e)
instance FiniteAbelianGroup Ordering
#if __GLASGOW_HASKELL__ >= 810
instance FiniteAbelianGroup a => FiniteAbelianGroup (Down a)
#endif