Basement.Compat.Natural

basement-0.0.16: 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 #

Natural number

Invariant: numbers <= 0xffffffffffffffff use the `NS` constructor

#### Instances

Instances details

PrintfArg Natural | Since: base-4.8.0.0
Instance details Defined in Text.Printf Methods formatArg :: Natural -> FieldFormatter # parseFormat :: Natural -> ModifierParser #
Integral Natural # |
Instance details Defined in Basement.Compat.NumLiteral Methods fromInteger :: Integer -> Natural #
NormalForm Natural # |
Instance details Defined in Basement.NormalForm Methods toNormalForm :: Natural -> () #
Additive Natural # |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Natural # (+) :: Natural -> Natural -> Natural # scale :: IsNatural n => n -> Natural -> Natural #
IDivisible Natural # |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Natural -> Natural -> Natural # mod :: Natural -> Natural -> Natural # divMod :: Natural -> Natural -> (Natural, Natural) #
Multiplicative Natural # |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Natural # (*) :: Natural -> Natural -> Natural # (^) :: (IsNatural n, Enum n, IDivisible n) => Natural -> n -> Natural #
IsIntegral Natural # |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Natural -> Integer #
IsNatural Natural # |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Natural -> Natural #
Subtractive Natural # |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Natural |
Instance details Defined in Basement.Numerical.Subtractive type Difference Natural = Maybe Natural
Methods (-) :: Natural -> Natural -> Difference Natural #
Bits Natural | @since base-4.8.0
Instance details Defined in GHC.Internal.Bits 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 #
Data Natural | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Data.Data 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 :: forall r r'. (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 #
Enum Natural | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Enum 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] #
Num Natural | Note that `Natural`'s `Num` instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though. @since base-4.8.0.0
Instance details Defined in GHC.Internal.Num Methods (+) :: Natural -> Natural -> Natural # (-) :: Natural -> Natural -> Natural # (*) :: Natural -> Natural -> Natural # negate :: Natural -> Natural # abs :: Natural -> Natural # signum :: Natural -> Natural # fromInteger :: Integer -> Natural #
Read Natural | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Read Methods readsPrec :: Int -> ReadS Natural # readList :: ReadS [Natural] # readPrec :: ReadPrec Natural # readListPrec :: ReadPrec [Natural] #
Integral Natural | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Real 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 #
Real Natural | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Real Methods toRational :: Natural -> Rational #
Show Natural | @since base-4.8.0.0
Instance details Defined in GHC.Internal.Show Methods showsPrec :: Int -> Natural -> ShowS # show :: Natural -> String # showList :: [Natural] -> ShowS #
Eq Natural |
Instance details Defined in GHC.Num.Natural Methods (==) :: Natural -> Natural -> Bool # (/=) :: Natural -> Natural -> Bool #
Ord Natural |
Instance details Defined in GHC.Num.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 #
KnownNat n => HasResolution (n :: Nat) | For example, `Fixed 1000` will give you a `Fixed` with a resolution of 1000.
Instance details Defined in Data.Fixed Methods resolution :: p n -> Integer #
IsNatural n => From n Natural # |
Instance details Defined in Basement.From Methods from :: n -> Natural #
IntegralDownsize Integer Natural # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Natural # integralDownsizeCheck :: Integer -> Maybe Natural #
IntegralDownsize Natural Word16 # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word16 # integralDownsizeCheck :: Natural -> Maybe Word16 #
IntegralDownsize Natural Word32 # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word32 # integralDownsizeCheck :: Natural -> Maybe Word32 #
IntegralDownsize Natural Word64 # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word64 # integralDownsizeCheck :: Natural -> Maybe Word64 #
IntegralDownsize Natural Word8 # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word8 # integralDownsizeCheck :: Natural -> Maybe Word8 #
IsNatural a => IntegralUpsize a Natural # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: a -> Natural #
TestCoercion SNat | @since base-4.18.0.0
Instance details Defined in GHC.Internal.TypeNats Methods testCoercion :: forall (a :: Nat) (b :: Nat). SNat a -> SNat b -> Maybe (Coercion a b) #
TestEquality SNat | @since base-4.18.0.0
Instance details Defined in GHC.Internal.TypeNats Methods testEquality :: forall (a :: Nat) (b :: Nat). SNat a -> SNat b -> Maybe (a :~: b) #
type Difference Natural # |
Instance details Defined in Basement.Numerical.Subtractive type Difference Natural = Maybe Natural
type Compare (a :: Natural) (b :: Natural) |
Instance details Defined in GHC.Internal.Data.Type.Ord type Compare (a :: Natural) (b :: Natural) = CmpNat a b

integerToNatural :: Integer -> Natural #

naturalToInteger :: Natural -> Integer #