{-# 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 :: forall (m :: Nat). KnownNat m => Mod m -> Integer
getMod = forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (n :: Nat) (proxy :: Nat -> *). KnownNat n => proxy n -> Nat
natVal
{-# INLINE getMod #-}
getNatMod :: KnownNat m => Mod m -> Natural
getNatMod :: forall (m :: Nat). KnownNat m => Mod m -> Nat
getNatMod = forall (n :: Nat) (proxy :: Nat -> *). KnownNat n => proxy n -> Nat
natVal
{-# INLINE getNatMod #-}
getVal :: Mod m -> Integer
getVal :: forall (m :: Nat). Mod m -> Integer
getVal = forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: Nat). Mod m -> Nat
unMod
{-# INLINE getVal #-}
getNatVal :: Mod m -> Natural
getNatVal :: forall (m :: Nat). Mod m -> Nat
getNatVal = forall (m :: Nat). Mod m -> Nat
unMod
{-# INLINE getNatVal #-}
powMod :: (KnownNat m, Integral a) => Mod m -> a -> Mod m
powMod :: forall (m :: Nat) a.
(KnownNat m, Integral a) =>
Mod m -> a -> Mod m
powMod = forall (m :: Nat) a.
(KnownNat m, Integral a) =>
Mod m -> a -> Mod m
(^%)
{-# INLINE powMod #-}