{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Math.NumberTheory.Moduli.Class
(
Mod
, getVal
, getNatVal
, getMod
, getNatMod
, invertMod
, powMod
, (^%)
, MultMod
, multElement
, isMultElement
, invertGroup
, SomeMod(..)
, modulo
, invertSomeMod
, powSomeMod
, KnownNat
) where
import Data.Mod
import GHC.Natural
import GHC.TypeNats (KnownNat, natVal)
import Math.NumberTheory.Moduli.Multiplicative
import Math.NumberTheory.Moduli.SomeMod
getMod :: KnownNat m => Mod m -> Integer
getMod :: Mod m -> Integer
getMod = Natural -> Integer
forall a. Integral a => a -> Integer
toInteger (Natural -> Integer) -> (Mod m -> Natural) -> Mod m -> Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod m -> Natural
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Natural
natVal
{-# INLINE getMod #-}
getNatMod :: KnownNat m => Mod m -> Natural
getNatMod :: Mod m -> Natural
getNatMod = Mod m -> Natural
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Natural
natVal
{-# INLINE getNatMod #-}
getVal :: Mod m -> Integer
getVal :: Mod m -> Integer
getVal = Natural -> Integer
forall a. Integral a => a -> Integer
toInteger (Natural -> Integer) -> (Mod m -> Natural) -> Mod m -> Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Mod m -> Natural
forall (m :: Nat). Mod m -> Natural
unMod
{-# INLINE getVal #-}
getNatVal :: Mod m -> Natural
getNatVal :: Mod m -> Natural
getNatVal = Mod m -> Natural
forall (m :: Nat). Mod m -> Natural
unMod
{-# INLINE getNatVal #-}
powMod :: (KnownNat m, Integral a) => Mod m -> a -> Mod m
powMod :: Mod m -> a -> Mod m
powMod = Mod m -> a -> Mod m
forall (m :: Nat) a.
(KnownNat m, Integral a) =>
Mod m -> a -> Mod m
(^%)
{-# INLINE powMod #-}