basement-0.0.15: Foundation scrap box of array & string
License BSD-style
Maintainer Haskell Foundation
Safe Haskell None
Language Haskell2010

Basement.Bounded

Description

Types to represent ℤ/nℤ.

ℤ/nℤ is a finite field and is defined as the set of natural number: {0, 1, ..., n − 1}.

Synopsis

Documentation

data Zn64 (n :: Nat ) Source #

A type level bounded natural backed by a Word64

Instances

Instances details
Eq ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

( KnownNat n, NatWithinBound Word64 n) => Num ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

Ord ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

Show ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

( KnownNat n, NatWithinBound Word64 n) => Integral ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

( KnownNat n, NatWithinBound Word64 n) => IsNatural ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

( KnownNat n, NatWithinBound Word64 n) => IsIntegral ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

( KnownNat n, NatWithinBound Word64 n) => Subtractive ( Zn64 n) Source #
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference ( Zn64 n) Source #

( KnownNat n, NatWithinBound Word64 n) => Additive ( Zn64 n) Source #
Instance details

Defined in Basement.Numerical.Additive

NormalForm ( Zn64 n) Source #
Instance details

Defined in Basement.NormalForm

From ( Zn64 n) Word256 Source #
Instance details

Defined in Basement.From

From ( Zn64 n) Word128 Source #
Instance details

Defined in Basement.From

From ( Zn64 n) Word64 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word32 n) => From ( Zn64 n) Word32 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word16 n) => From ( Zn64 n) Word16 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word8 n) => From ( Zn64 n) Word8 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word64 n) => From ( Zn n) ( Zn64 n) Source #
Instance details

Defined in Basement.From

KnownNat n => From ( Zn64 n) ( Zn n) Source #
Instance details

Defined in Basement.From

type NatNumMaxBound ( Zn64 n) Source #
Instance details

Defined in Basement.Bounded

type Difference ( Zn64 n) Source #
Instance details

Defined in Basement.Numerical.Subtractive

data Zn (n :: Nat ) Source #

A type level bounded natural

Instances

Instances details
Eq ( Zn n) Source #
Instance details

Defined in Basement.Bounded

KnownNat n => Num ( Zn n) Source #
Instance details

Defined in Basement.Bounded

Ord ( Zn n) Source #
Instance details

Defined in Basement.Bounded

Show ( Zn n) Source #
Instance details

Defined in Basement.Bounded

KnownNat n => Integral ( Zn n) Source #
Instance details

Defined in Basement.Bounded

KnownNat n => IsNatural ( Zn n) Source #
Instance details

Defined in Basement.Bounded

KnownNat n => IsIntegral ( Zn n) Source #
Instance details

Defined in Basement.Bounded

KnownNat n => Subtractive ( Zn n) Source #
Instance details

Defined in Basement.Numerical.Subtractive

Associated Types

type Difference ( Zn n) Source #

KnownNat n => Additive ( Zn n) Source #
Instance details

Defined in Basement.Numerical.Additive

NormalForm ( Zn n) Source #
Instance details

Defined in Basement.NormalForm

( KnownNat n, NatWithinBound Word256 n) => From ( Zn n) Word256 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word128 n) => From ( Zn n) Word128 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word64 n) => From ( Zn n) Word64 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word32 n) => From ( Zn n) Word32 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word16 n) => From ( Zn n) Word16 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word8 n) => From ( Zn n) Word8 Source #
Instance details

Defined in Basement.From

( KnownNat n, NatWithinBound Word64 n) => From ( Zn n) ( Zn64 n) Source #
Instance details

Defined in Basement.From

KnownNat n => From ( Zn64 n) ( Zn n) Source #
Instance details

Defined in Basement.From

type NatNumMaxBound ( Zn n) Source #
Instance details

Defined in Basement.Bounded

type Difference ( Zn n) Source #
Instance details

Defined in Basement.Numerical.Subtractive

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

zn64Nat :: forall m n. ( KnownNat m, KnownNat n, NatWithinBound Word64 m, NatWithinBound Word64 n, CmpNat m n ~ ' LT ) => Proxy m -> Zn64 n Source #

Create an element of ℤ/nℤ from a type level Nat

znNat :: forall m n. ( KnownNat m, KnownNat n, CmpNat m n ~ ' LT ) => Proxy m -> Zn n Source #

Create an element of ℤ/nℤ from a type level Nat