basement-0.0.4: Foundation scrap box of array & string

Safe Haskell | None
Language | Haskell2010

Basement.Compat.Natural

Synopsis

- data Natural :: *
- integerToNatural :: Integer -> Natural
- naturalToInteger :: Natural -> Integer

# Documentation

data Natural :: * #

Type representing arbitrary-precision non-negative integers.

Operations whose result would be negative ``throw` (`Underflow` :: `ArithException`)`.

Since: 4.8.0.0

Instances

Enum Natural |
Methods succ :: Natural -> Natural # pred :: Natural -> Natural # toEnum :: Int -> Natural # fromEnum :: Natural -> Int # enumFrom :: Natural -> [Natural] # enumFromThen :: Natural -> Natural -> [Natural] # enumFromTo :: Natural -> Natural -> [Natural] # enumFromThenTo :: Natural -> Natural -> Natural -> [Natural] #
Eq Natural |
Methods (==) :: Natural -> Natural -> Bool # (/=) :: Natural -> Natural -> Bool #
Integral Natural |
Methods quot :: Natural -> Natural -> Natural # rem :: Natural -> Natural -> Natural # div :: Natural -> Natural -> Natural # mod :: Natural -> Natural -> Natural # quotRem :: Natural -> Natural -> (Natural, Natural) # divMod :: Natural -> Natural -> (Natural, Natural) # toInteger :: Natural -> Integer #
Data Natural |

Methods

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

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

toConstr :: Natural -> Constr #

dataTypeOf :: Natural -> DataType #

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

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

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

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

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

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

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

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

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

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

Num Natural |
Methods (+) :: Natural -> Natural -> Natural # (-) :: Natural -> Natural -> Natural # (*) :: Natural -> Natural -> Natural # negate :: Natural -> Natural # abs :: Natural -> Natural # signum :: Natural -> Natural # fromInteger :: Integer -> Natural #
Ord Natural |
Methods compare :: Natural -> Natural -> Ordering # (<) :: Natural -> Natural -> Bool # (<=) :: Natural -> Natural -> Bool # (>) :: Natural -> Natural -> Bool # (>=) :: Natural -> Natural -> Bool # max :: Natural -> Natural -> Natural # min :: Natural -> Natural -> Natural #
Read Natural |
Methods readsPrec :: Int -> ReadS Natural # readList :: ReadS [Natural] # readPrec :: ReadPrec Natural # readListPrec :: ReadPrec [Natural] #
Real Natural |
Methods toRational :: Natural -> Rational #
Show Natural |
Methods showsPrec :: Int -> Natural -> ShowS # show :: Natural -> String # showList :: [Natural] -> ShowS #
Ix Natural |
Methods range :: (Natural, Natural) -> [Natural] # index :: (Natural, Natural) -> Natural -> Int # unsafeIndex :: (Natural, Natural) -> Natural -> Int inRange :: (Natural, Natural) -> Natural -> Bool # rangeSize :: (Natural, Natural) -> Int # unsafeRangeSize :: (Natural, Natural) -> Int
Bits Natural |

Methods

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

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

xor :: Natural -> Natural -> Natural #

complement :: Natural -> Natural #

shift :: Natural -> Int -> Natural #

rotate :: Natural -> Int -> Natural #

zeroBits :: Natural #

bit :: Int -> Natural #

setBit :: Natural -> Int -> Natural #

clearBit :: Natural -> Int -> Natural #

complementBit :: Natural -> Int -> Natural #

testBit :: Natural -> Int -> Bool #

bitSizeMaybe :: Natural -> Maybe Int #

bitSize :: Natural -> Int #

isSigned :: Natural -> Bool #

shiftL :: Natural -> Int -> Natural #

unsafeShiftL :: Natural -> Int -> Natural #

shiftR :: Natural -> Int -> Natural #

unsafeShiftR :: Natural -> Int -> Natural #

rotateL :: Natural -> Int -> Natural #

rotateR :: Natural -> Int -> Natural #

popCount :: Natural -> Int #

Integral Natural Source # |
Methods fromInteger :: Integer -> Natural Source #
IsNatural Natural Source # |
Methods toNatural :: Natural -> Natural Source #
IsIntegral Natural Source # |
Methods toInteger :: Natural -> Integer Source #
Additive Natural Source # |
Methods azero :: Natural Source # (+) :: Natural -> Natural -> Natural Source # scale :: IsNatural n => n -> Natural -> Natural Source #
IDivisible Natural Source # |
Methods div :: Natural -> Natural -> Natural Source # mod :: Natural -> Natural -> Natural Source # divMod :: Natural -> Natural -> (Natural, Natural) Source #
Multiplicative Natural Source # |
Methods midentity :: Natural Source # (*) :: Natural -> Natural -> Natural Source # (^) :: (IsNatural n, IDivisible n) => Natural -> n -> Natural Source #
Subtractive Natural Source # |
Associated Types type Difference Natural :: * Source # Methods (-) :: Natural -> Natural -> Difference Natural Source #
NormalForm Natural Source # |
Methods toNormalForm :: Natural -> () Source #
IsNatural a => IntegralUpsize a Natural Source # |
Methods integralUpsize :: a -> Natural Source #
IntegralDownsize Integer Natural Source # |
Methods integralDownsize :: Integer -> Natural Source # integralDownsizeCheck :: Integer -> Maybe Natural Source #
IntegralDownsize Natural Word8 Source # |
Methods integralDownsize :: Natural -> Word8 Source # integralDownsizeCheck :: Natural -> Maybe Word8 Source #
IntegralDownsize Natural Word16 Source # |
Methods integralDownsize :: Natural -> Word16 Source # integralDownsizeCheck :: Natural -> Maybe Word16 Source #
IntegralDownsize Natural Word32 Source # |
Methods integralDownsize :: Natural -> Word32 Source # integralDownsizeCheck :: Natural -> Maybe Word32 Source #
IntegralDownsize Natural Word64 Source # |
Methods integralDownsize :: Natural -> Word64 Source # integralDownsizeCheck :: Natural -> Maybe Word64 Source #
IsNatural n => From n Natural Source # |
Methods from :: n -> Natural Source #
type Difference Natural Source # |
type Difference Natural = Maybe Natural

integerToNatural :: Integer -> Natural Source #

naturalToInteger :: Natural -> Integer Source #