HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulebase-4.22.0.0Haskell2010

GHC.Num.Natural

  • 1 type
  • 81 values
  • Packagebase-4.22.0.0
  • Exports82
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceNatural.hs
valuenaturalFromAddr :: Word# -> Addr# -> Bool# -> IO Natural
#

Read a Natural in base-256 representation from an Addr#.

The size is given in bytes.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Null higher limbs are automatically trimed.

valuenaturalFromAddr#
  1. :: Word#
  2. -> Addr#
  3. -> Bool#
  4. -> State# s
  5. -> (# State# s, Natural #)
#

Read a Natural in base-256 representation from an Addr#.

The size is given in bytes.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Null higher limbs are automatically trimed.

Read a Natural in base-256 representation from a ByteArray#.

The size is given in bytes.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Null higher limbs are automatically trimed.

valuenaturalToAddr :: Natural -> Addr# -> Bool# -> IO Word
#

Write a Natural to addr in base-256 representation and return the number of bytes written.

The endianness is selected with the Bool# parameter: write most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

valuenaturalToAddr#
  1. :: Natural
  2. -> Addr#
  3. -> Bool#
  4. -> State# s
  5. -> (# State# s, Word# #)
#

Write a Natural to addr in base-256 representation and return the number of bytes written.

The endianness is selected with the Bool# parameter: write most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

datadata Natural
#

Natural number

Invariant: numbers <= 0xffffffffffffffff use the NS constructor

Constructors

Instances16Enum, Eq, Integral, Data, Num, Ord, …
  • Enum NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Enum
  • Eq NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Bignum.Natural
  • Integral NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Real
  • Data NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Data
  • Num NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Num

    Note that Natural's Num instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though.

  • Ord NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Bignum.Natural
  • Read NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Read
  • Real NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Real
  • Show NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Show
  • Ix NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Ix
  • Bits NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.Bits
  • PrintfArg NaturalDefined in base-4.22.0.0 · Text.Printf
  • Lift NaturalDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Lift
  • TestCoercion SNatDefined in ghc-internal-9.1401.0 · GHC.Internal.TypeNats
  • TestEquality SNatDefined in ghc-internal-9.1401.0 · GHC.Internal.TypeNats
  • type Compare a b = CmpNat a bDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Type.Ord