Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Integer
- data Natural
- data Positive
- data Signed where
- data Sign
- class Subtraction a where
- subtractInteger :: a -> a -> Integer
- subtractSigned :: a -> a -> Signed
- class Subtraction' b where
- subtract :: Subtraction a => a -> a -> b
- class IntegerNarrow a b where
- class IntegerNarrow a b => IntegerConvert a b where
- convert :: a -> b
- class (IntegerConvert a b, IntegerConvert b a) => IntegerEquiv a b
- yolo :: (Integral a, Num b) => a -> b
- class ConvertWithFinite a where
- class (Bounded b, Integral b) => Finite b where
- toFinite :: ConvertWithFinite a => a -> Maybe b
- fromFinite :: ConvertWithFinite a => b -> Maybe a
- class BoundedBelow a where
- minBound :: a
Types
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int
, the Integer
type represents the entire infinite range of
integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (fit into an Int
), IS
constructor is used.
Otherwise Integer
and IN
constructors are used to store a BigNat
representing respectively the positive or the negative value magnitude.
Invariant: Integer
and IN
are used iff value doesn't fit in IS
Instances
Natural number
Invariant: numbers <= 0xffffffffffffffff use the NS
constructor
Instances
Instances
Instances
Subtraction
class Subtraction a where Source #
Domain of a subtraction operation
Nothing
subtractInteger :: a -> a -> Integer Source #
subtractSigned :: a -> a -> Signed Source #
Instances
Subtraction Positive Source # | |
Defined in Integer.Subtraction | |
Subtraction Signed Source # | |
Defined in Integer.Subtraction | |
Subtraction Integer Source # | |
Defined in Integer.Subtraction | |
Subtraction Natural Source # | |
Defined in Integer.Subtraction |
class Subtraction' b where Source #
Codomain of a subtraction operation
subtract :: Subtraction a => a -> a -> b Source #
Instances
Subtraction' Signed Source # | |
Defined in Integer.Subtraction subtract :: Subtraction a => a -> a -> Signed Source # | |
Subtraction' Integer Source # | |
Defined in Integer.Subtraction subtract :: Subtraction a => a -> a -> Integer Source # |
Conversion
class IntegerNarrow a b where Source #
Instances
class IntegerNarrow a b => IntegerConvert a b where Source #
Instances
class (IntegerConvert a b, IntegerConvert b a) => IntegerEquiv a b Source #
Instances
IntegerEquiv Positive Positive Source # | |
Defined in Integer.Conversion | |
IntegerEquiv Signed Signed Source # | |
Defined in Integer.Conversion | |
IntegerEquiv Signed Integer Source # | |
Defined in Integer.Conversion | |
IntegerEquiv Integer Signed Source # | |
Defined in Integer.Conversion | |
IntegerEquiv Integer Integer Source # | |
Defined in Integer.Conversion | |
IntegerEquiv Natural Natural Source # | |
Defined in Integer.Conversion |
yolo :: (Integral a, Num b) => a -> b Source #
Partial conversion between Integral
types via Integer
yolo =fromInteger
.toInteger
class ConvertWithFinite a where Source #
toWord :: a -> Maybe Word Source #
fromWord :: Word -> Maybe a Source #
class (Bounded b, Integral b) => Finite b where Source #
toFinite :: ConvertWithFinite a => a -> Maybe b Source #
fromFinite :: ConvertWithFinite a => b -> Maybe a Source #
Instances
Finite Int Source # | |
Defined in Integer.Finite toFinite :: ConvertWithFinite a => a -> Maybe Int Source # fromFinite :: ConvertWithFinite a => Int -> Maybe a Source # | |
Finite Word Source # | |
Defined in Integer.Finite toFinite :: ConvertWithFinite a => a -> Maybe Word Source # fromFinite :: ConvertWithFinite a => Word -> Maybe a Source # |
Lower bound
class BoundedBelow a where Source #
Instances
BoundedBelow Positive Source # | |
Defined in Integer.Positive.Unsafe | |
BoundedBelow Natural Source # | |
Defined in Integer.BoundedBelow |