module Math.NumberTheory.Primes.Types
( Prime
, Prm(..)
, PrimeNat(..)
) where
#if MIN_VERSION_base(4,8,0)
#else
import Data.Word
#endif
import Numeric.Natural
newtype Prm = Prm { unPrm :: Word }
deriving (Eq, Ord)
instance Show Prm where
showsPrec d (Prm p) r = (if d > 10 then "(" ++ s ++ ")" else s) ++ r
where
s = "Prm " ++ show p
newtype PrimeNat = PrimeNat { unPrimeNat :: Natural }
deriving (Eq, Ord)
instance Show PrimeNat where
showsPrec d (PrimeNat p) r = (if d > 10 then "(" ++ s ++ ")" else s) ++ r
where
s = "PrimeNat " ++ show p
type family Prime (f :: *) :: *
type instance Prime Int = Prm
type instance Prime Word = Prm
type instance Prime Integer = PrimeNat
type instance Prime Natural = PrimeNat