License | BSD-style |
---|---|
Maintainer | Haskell Foundation |
Safe Haskell | None |
Language | Haskell2010 |
Types to represent ℤ/nℤ.
ℤ/nℤ is a finite field and is defined as the set of natural number: {0, 1, ..., n − 1}.
- data Zn64 n
- unZn64 :: Zn64 n -> Word64
- data Zn n
- unZn :: Zn n -> Natural
- zn64 :: forall n. (KnownNat n, NatWithinBound Word64 n) => Word64 -> Zn64 n
- zn :: forall n. KnownNat n => Natural -> Zn n
- zn64Nat :: forall m n. (KnownNat m, KnownNat n, NatWithinBound Word64 m, NatWithinBound Word64 n, CmpNat m n ~ LT) => Proxy m -> Zn64 n
- znNat :: forall m n. (KnownNat m, KnownNat n, CmpNat m n ~ LT) => Proxy m -> Zn n
Documentation
A type level bounded natural backed by a Word64
Eq (Zn64 n) Source # | |
Ord (Zn64 n) Source # | |
Show (Zn64 n) Source # | |
From (Zn64 n) Word256 Source # | |
From (Zn64 n) Word128 Source # | |
From (Zn64 n) Word64 Source # | |
(KnownNat n, NatWithinBound Word32 n) => From (Zn64 n) Word32 Source # | |
(KnownNat n, NatWithinBound Word16 n) => From (Zn64 n) Word16 Source # | |
(KnownNat n, NatWithinBound Word8 n) => From (Zn64 n) Word8 Source # | |
(KnownNat n, NatWithinBound Word64 n) => From (Zn n) (Zn64 n) Source # | |
KnownNat n => From (Zn64 n) (Zn n) Source # | |
A type level bounded natural
Eq (Zn n) Source # | |
Ord (Zn n) Source # | |
Show (Zn n) Source # | |
(KnownNat n, NatWithinBound Word256 n) => From (Zn n) Word256 Source # | |
(KnownNat n, NatWithinBound Word128 n) => From (Zn n) Word128 Source # | |
(KnownNat n, NatWithinBound Word64 n) => From (Zn n) Word64 Source # | |
(KnownNat n, NatWithinBound Word32 n) => From (Zn n) Word32 Source # | |
(KnownNat n, NatWithinBound Word16 n) => From (Zn n) Word16 Source # | |
(KnownNat n, NatWithinBound Word8 n) => From (Zn n) Word8 Source # | |
(KnownNat n, NatWithinBound Word64 n) => From (Zn n) (Zn64 n) Source # | |
KnownNat n => From (Zn64 n) (Zn n) Source # | |
zn64 :: forall n. (KnownNat n, NatWithinBound Word64 n) => Word64 -> Zn64 n Source #
Create an element of ℤ/nℤ from a Word64
If the value is greater than n, then the value is normalized by using the integer modulus n
zn :: forall n. KnownNat n => Natural -> Zn n Source #
Create an element of ℤ/nℤ from a Natural.
If the value is greater than n, then the value is normalized by using the integer modulus n