Movatterモバイル変換


[0]ホーム

URL:


base-4.12.0.0: Basic libraries

Copyright(C) 2014 Herbert Valerio Riedel
(C) 2011 Edward Kmett
Licensesee libraries/base/LICENSE
Maintainerlibraries@haskell.org
Stabilityinternal
Portabilitynon-portable (GHC Extensions)
Safe HaskellNone
LanguageHaskell2010

GHC.Natural

Contents

Description

The arbitrary-precisionNatural number type.

Note: This is an internal GHC module with an API subject to change. It's recommended use theNumeric.Natural module to import theNatural type.

Since: 4.8.0.0

Synopsis

TheNatural number type

Warning: The internal implementation ofNatural (i.e. which constructors are available) depends on theInteger backend used!

dataNaturalSource#

Type representing arbitrary-precision non-negative integers.

>>>2^100 :: Natural1267650600228229401496703205376

Operations whose result would be negativethrow (Underflow ::ArithException),

>>>-1 :: Natural*** Exception: arithmetic underflow

Since: 4.8.0.0

Constructors

NatS#GmpLimb#

in[0, maxBound::Word]

NatJ# !BigNat

in]maxBound::Word, +inf[

Invariant:NatJ# is usediff value doesn't fit inNatS# constructor. NB: Order of constructors *must* coincide withOrd relation

Instances
EnumNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Enum

EqNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Natural

IntegralNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Real

DataNaturalSource#

Since: 4.8.0.0

Instance details

Defined inData.Data

Methods

gfoldl :: (forall d b.Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) ->Natural -> cNaturalSource#

gunfold :: (forall b r.Data b => c (b -> r) -> c r) -> (forall r. r -> c r) ->Constr -> cNaturalSource#

toConstr ::Natural ->ConstrSource#

dataTypeOf ::Natural ->DataTypeSource#

dataCast1 ::Typeable t => (forall d.Data d => c (t d)) ->Maybe (cNatural)Source#

dataCast2 ::Typeable t => (forall d e. (Data d,Data e) => c (t d e)) ->Maybe (cNatural)Source#

gmapT :: (forall b.Data b => b -> b) ->Natural ->NaturalSource#

gmapQl :: (r -> r' -> r) -> r -> (forall d.Data d => d -> r') ->Natural -> rSource#

gmapQr :: (r' -> r -> r) -> r -> (forall d.Data d => d -> r') ->Natural -> rSource#

gmapQ :: (forall d.Data d => d -> u) ->Natural -> [u]Source#

gmapQi ::Int -> (forall d.Data d => d -> u) ->Natural -> uSource#

gmapM ::Monad m => (forall d.Data d => d -> m d) ->Natural -> mNaturalSource#

gmapMp ::MonadPlus m => (forall d.Data d => d -> m d) ->Natural -> mNaturalSource#

gmapMo ::MonadPlus m => (forall d.Data d => d -> m d) ->Natural -> mNaturalSource#

NumNaturalSource#

Note thatNatural'sNum instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though.

Since: 4.8.0.0

Instance details

Defined inGHC.Num

OrdNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Natural

ReadNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Read

RealNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Real

ShowNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Show

IxNaturalSource#

Since: 4.8.0.0

Instance details

Defined inGHC.Arr

BitsNaturalSource#

Since: 4.8.0

Instance details

Defined inData.Bits

Methods

(.&.) ::Natural ->Natural ->NaturalSource#

(.|.) ::Natural ->Natural ->NaturalSource#

xor ::Natural ->Natural ->NaturalSource#

complement ::Natural ->NaturalSource#

shift ::Natural ->Int ->NaturalSource#

rotate ::Natural ->Int ->NaturalSource#

zeroBits ::NaturalSource#

bit ::Int ->NaturalSource#

setBit ::Natural ->Int ->NaturalSource#

clearBit ::Natural ->Int ->NaturalSource#

complementBit ::Natural ->Int ->NaturalSource#

testBit ::Natural ->Int ->BoolSource#

bitSizeMaybe ::Natural ->MaybeIntSource#

bitSize ::Natural ->IntSource#

isSigned ::Natural ->BoolSource#

shiftL ::Natural ->Int ->NaturalSource#

unsafeShiftL ::Natural ->Int ->NaturalSource#

shiftR ::Natural ->Int ->NaturalSource#

unsafeShiftR ::Natural ->Int ->NaturalSource#

rotateL ::Natural ->Int ->NaturalSource#

rotateR ::Natural ->Int ->NaturalSource#

popCount ::Natural ->IntSource#

PrintfArgNaturalSource#

Since: 4.8.0.0

Instance details

Defined inText.Printf

mkNaturalSource#

Arguments

:: [Word]

value expressed in 32 bit chunks, least significant first

->Natural 

ConstructNatural value from list ofWords.

This function is used by GHC for constructingNatural literals.

isValidNatural ::Natural ->BoolSource#

Test whether all internal invariants are satisfied byNatural value

This operation is mostly useful for test-suites and/or code which constructsInteger values directly.

Since: 4.8.0.0

Arithmetic

plusNatural ::Natural ->Natural ->NaturalSource#

Natural Addition

minusNatural ::Natural ->Natural ->NaturalSource#

Natural subtraction. MaythrowUnderflow.

minusNaturalMaybe ::Natural ->Natural ->MaybeNaturalSource#

Natural subtraction. ReturnsNothings for non-positive results.

Since: 4.8.0.0

timesNatural ::Natural ->Natural ->NaturalSource#

Natural multiplication

negateNatural ::Natural ->NaturalSource#

signumNatural ::Natural ->NaturalSource#

quotRemNatural ::Natural ->Natural -> (Natural,Natural)Source#

quotNatural ::Natural ->Natural ->NaturalSource#

remNatural ::Natural ->Natural ->NaturalSource#

gcdNatural ::Natural ->Natural ->NaturalSource#

Compute greatest common divisor.

lcmNatural ::Natural ->Natural ->NaturalSource#

compute least common multiplier.

Bits

andNatural ::Natural ->Natural ->NaturalSource#

orNatural ::Natural ->Natural ->NaturalSource#

xorNatural ::Natural ->Natural ->NaturalSource#

bitNatural ::Int# ->NaturalSource#

testBitNatural ::Natural ->Int ->BoolSource#

popCountNatural ::Natural ->IntSource#

shiftLNatural ::Natural ->Int ->NaturalSource#

shiftRNatural ::Natural ->Int ->NaturalSource#

Conversions

naturalToInteger ::Natural ->IntegerSource#

@since 4.X.0.0

naturalToWord ::Natural ->WordSource#

naturalToInt ::Natural ->IntSource#

naturalFromInteger ::Integer ->NaturalSource#

Since: 4.10.0.0

wordToNatural ::Word ->NaturalSource#

ConstructNatural fromWord value.

Since: 4.8.0.0

intToNatural ::Int ->NaturalSource#

ConvertInt toNatural. ThrowsUnderflow when passed a negativeInt.

naturalToWordMaybe ::Natural ->MaybeWordSource#

Try downcastingNatural toWord value. ReturnsNothing if value doesn't fit inWord.

Since: 4.8.0.0

wordToNatural# ::Word# ->NaturalSource#

Convert a Word# into a Natural

Built-in rule ensures that applications of this function to literal Word# are lifted into Natural literals.

wordToNaturalBase ::Word# ->NaturalSource#

Convert a Word# into a Natural

In base we can't use wordToNatural# as built-in rules transform some of them into Natural literals. Use this function instead.

Modular arithmetic

powModNatural ::Natural ->Natural ->Natural ->NaturalSource#

"powModNaturalbem" computes baseb raised to exponente modulom.

Since: 4.8.0.0

Produced byHaddock version 2.20.0


[8]ページ先頭

©2009-2025 Movatter.jp