-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Integer, Natural, and Positive -- -- The base package contains two unbounded integral types: Integer (-∞, -- ∞) and Natural (0, ∞). This package expands that integral repertoire -- with the addition of Positive (1, ∞). @package integer-types @version 0.1.4.1 module Integer.BoundedBelow class BoundedBelow a minBound :: BoundedBelow a => a instance Integer.BoundedBelow.BoundedBelow GHC.Num.Natural.Natural module Integer.Sign data Sign MinusSign :: Sign PlusSign :: Sign negate :: Sign -> Sign multiply :: Sign -> Sign -> Sign instance GHC.Enum.Bounded Integer.Sign.Sign instance GHC.Enum.Enum Integer.Sign.Sign instance GHC.Show.Show Integer.Sign.Sign instance GHC.Classes.Ord Integer.Sign.Sign instance GHC.Classes.Eq Integer.Sign.Sign instance Control.DeepSeq.NFData Integer.Sign.Sign instance Data.Hashable.Class.Hashable Integer.Sign.Sign module Integer.Signed data Signed Zero :: Signed NonZero :: Sign -> Positive -> Signed pattern Plus :: Positive -> Signed pattern Minus :: Positive -> Signed -- | A Signed that is either zero or negative; the Natural -- gives the magnitude of the negative pattern NotPlus :: Natural -> Signed -- | A Signed that is either zero or positive pattern NotMinus :: Natural -> Signed toInteger :: Signed -> Integer fromInteger :: Integer -> Signed toNatural :: Signed -> Maybe Natural fromNatural :: Natural -> Signed toPositive :: Signed -> Maybe Positive fromPositive :: Positive -> Signed toInt :: Signed -> Maybe Int fromInt :: Int -> Signed toWord :: Signed -> Maybe Word fromWord :: Word -> Signed increase :: Natural -> Signed -> Signed strictlyIncrease :: Positive -> Signed -> Signed one :: Signed addOne :: Signed -> Signed subtractOne :: Signed -> Signed instance GHC.Classes.Eq Integer.Signed.Signed instance GHC.Classes.Ord Integer.Signed.Signed instance Control.DeepSeq.NFData Integer.Signed.Signed instance Data.Hashable.Class.Hashable Integer.Signed.Signed instance GHC.Num.Num Integer.Signed.Signed instance GHC.Enum.Enum Integer.Signed.Signed instance GHC.Real.Real Integer.Signed.Signed instance GHC.Real.Integral Integer.Signed.Signed instance GHC.Show.Show Integer.Signed.Signed module Integer.Positive data Positive toNatural :: Positive -> Natural fromNatural :: Natural -> Maybe Positive toInteger :: Positive -> Integer fromInteger :: Integer -> Maybe Positive toSigned :: Positive -> Signed fromSigned :: Signed -> Maybe Positive toInt :: Positive -> Maybe Int fromInt :: Int -> Maybe Positive toWord :: Positive -> Maybe Word fromWord :: Word -> Maybe Positive subtract :: Positive -> Positive -> Signed increase :: Natural -> Positive -> Positive one :: Positive addOne :: Positive -> Positive subtractOne :: Positive -> Natural length :: NonEmpty a -> Positive module Integer.Natural -- | Natural number -- -- Invariant: numbers <= 0xffffffffffffffff use the NS -- constructor data () => Natural toPositive :: Natural -> Maybe Positive fromPositive :: Positive -> Natural toInteger :: Natural -> Integer fromInteger :: Integer -> Maybe Natural toSigned :: Natural -> Signed fromSigned :: Signed -> Maybe Natural toInt :: Natural -> Maybe Int fromInt :: Int -> Maybe Natural toWord :: Natural -> Maybe Word fromWord :: Word -> Natural subtract :: Natural -> Natural -> Signed strictlyIncrease :: Positive -> Natural -> Natural one :: Natural addOne :: Natural -> Positive subtractOne :: Natural -> Maybe Signed length :: [a] -> Natural module Integer.Integer -- | 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 data () => Integer toPositive :: Integer -> Maybe Positive fromPositive :: Positive -> Integer toNatural :: Integer -> Maybe Natural fromNatural :: Natural -> Integer toSigned :: Integer -> Signed fromSigned :: Signed -> Integer toInt :: Integer -> Maybe Int fromInt :: Int -> Integer toWord :: Integer -> Maybe Word fromWord :: Word -> Integer increase :: Natural -> Integer -> Integer strictlyIncrease :: Positive -> Integer -> Integer module Integer.Increase -- | Class of numbers are closed under addition with Natural class Increase a -- | Addition increase :: Increase a => Natural -> a -> a instance Integer.Increase.Increase GHC.Num.Integer.Integer instance Integer.Increase.Increase Integer.Signed.Signed instance Integer.Increase.Increase GHC.Num.Natural.Natural instance Integer.Increase.Increase Integer.Positive.Unsafe.Positive module Integer.Finite class ConvertWithFinite a toWord :: ConvertWithFinite a => a -> Maybe Word fromWord :: ConvertWithFinite a => Word -> Maybe a toInt :: ConvertWithFinite a => a -> Maybe Int fromInt :: ConvertWithFinite a => Int -> Maybe a class (Bounded b, Integral b) => Finite b toFinite :: (Finite b, ConvertWithFinite a) => a -> Maybe b fromFinite :: (Finite b, ConvertWithFinite a) => b -> Maybe a instance Integer.Finite.Finite GHC.Types.Int instance Integer.Finite.Finite GHC.Types.Word instance Integer.Finite.ConvertWithFinite GHC.Num.Natural.Natural instance Integer.Finite.ConvertWithFinite Integer.Positive.Unsafe.Positive instance Integer.Finite.ConvertWithFinite GHC.Num.Integer.Integer instance Integer.Finite.ConvertWithFinite Integer.Signed.Signed module Integer.Conversion class IntegerNarrow a b narrow :: IntegerNarrow a b => a -> Maybe b class IntegerNarrow a b => IntegerConvert a b convert :: IntegerConvert a b => a -> b class (IntegerConvert a b, IntegerConvert b a) => IntegerEquiv a b -- | Partial conversion between Integral types via Integer -- --
-- yolo = fromInteger . toInteger --yolo :: (Integral a, Num b) => a -> b instance Integer.Conversion.IntegerEquiv GHC.Num.Integer.Integer GHC.Num.Integer.Integer instance Integer.Conversion.IntegerEquiv GHC.Num.Natural.Natural GHC.Num.Natural.Natural instance Integer.Conversion.IntegerEquiv Integer.Positive.Unsafe.Positive Integer.Positive.Unsafe.Positive instance Integer.Conversion.IntegerEquiv Integer.Signed.Signed Integer.Signed.Signed instance Integer.Conversion.IntegerEquiv GHC.Num.Integer.Integer Integer.Signed.Signed instance Integer.Conversion.IntegerEquiv Integer.Signed.Signed GHC.Num.Integer.Integer instance Integer.Conversion.IntegerConvert GHC.Num.Integer.Integer GHC.Num.Integer.Integer instance Integer.Conversion.IntegerConvert GHC.Num.Natural.Natural GHC.Num.Natural.Natural instance Integer.Conversion.IntegerConvert Integer.Positive.Unsafe.Positive Integer.Positive.Unsafe.Positive instance Integer.Conversion.IntegerConvert Integer.Signed.Signed Integer.Signed.Signed instance Integer.Conversion.IntegerConvert GHC.Num.Integer.Integer Integer.Signed.Signed instance Integer.Conversion.IntegerNarrow GHC.Num.Integer.Integer Integer.Signed.Signed instance Integer.Conversion.IntegerConvert Integer.Signed.Signed GHC.Num.Integer.Integer instance Integer.Conversion.IntegerNarrow Integer.Signed.Signed GHC.Num.Integer.Integer instance Integer.Conversion.IntegerNarrow GHC.Num.Natural.Natural GHC.Num.Integer.Integer instance Integer.Conversion.IntegerConvert GHC.Num.Natural.Natural GHC.Num.Integer.Integer instance Integer.Conversion.IntegerNarrow GHC.Num.Natural.Natural Integer.Signed.Signed instance Integer.Conversion.IntegerConvert GHC.Num.Natural.Natural Integer.Signed.Signed instance Integer.Conversion.IntegerNarrow Integer.Positive.Unsafe.Positive GHC.Num.Integer.Integer instance Integer.Conversion.IntegerConvert Integer.Positive.Unsafe.Positive GHC.Num.Integer.Integer instance Integer.Conversion.IntegerNarrow Integer.Positive.Unsafe.Positive GHC.Num.Natural.Natural instance Integer.Conversion.IntegerConvert Integer.Positive.Unsafe.Positive GHC.Num.Natural.Natural instance Integer.Conversion.IntegerNarrow Integer.Positive.Unsafe.Positive Integer.Signed.Signed instance Integer.Conversion.IntegerConvert Integer.Positive.Unsafe.Positive Integer.Signed.Signed instance Integer.Conversion.IntegerNarrow GHC.Num.Integer.Integer GHC.Num.Integer.Integer instance Integer.Conversion.IntegerNarrow GHC.Num.Natural.Natural GHC.Num.Natural.Natural instance Integer.Conversion.IntegerNarrow Integer.Positive.Unsafe.Positive Integer.Positive.Unsafe.Positive instance Integer.Conversion.IntegerNarrow Integer.Signed.Signed Integer.Signed.Signed instance Integer.Conversion.IntegerNarrow GHC.Num.Integer.Integer GHC.Num.Natural.Natural instance Integer.Conversion.IntegerNarrow Integer.Signed.Signed GHC.Num.Natural.Natural instance Integer.Conversion.IntegerNarrow GHC.Num.Integer.Integer Integer.Positive.Unsafe.Positive instance Integer.Conversion.IntegerNarrow GHC.Num.Natural.Natural Integer.Positive.Unsafe.Positive instance Integer.Conversion.IntegerNarrow Integer.Signed.Signed Integer.Positive.Unsafe.Positive module Integer.AbsoluteDifference class AbsoluteDifference a b absoluteDifference :: AbsoluteDifference a b => a -> b -> Natural instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Integer.Integer GHC.Num.Integer.Integer instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Natural.Natural GHC.Num.Natural.Natural instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Positive.Unsafe.Positive Integer.Positive.Unsafe.Positive instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Signed.Signed Integer.Signed.Signed instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Positive.Unsafe.Positive GHC.Num.Natural.Natural instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Natural.Natural Integer.Positive.Unsafe.Positive instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Signed.Signed GHC.Num.Natural.Natural instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Natural.Natural Integer.Signed.Signed instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Integer.Integer GHC.Num.Natural.Natural instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Natural.Natural GHC.Num.Integer.Integer instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Signed.Signed Integer.Positive.Unsafe.Positive instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Positive.Unsafe.Positive Integer.Signed.Signed instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Signed.Signed GHC.Num.Integer.Integer instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Integer.Integer Integer.Signed.Signed instance Integer.AbsoluteDifference.AbsoluteDifference Integer.Positive.Unsafe.Positive GHC.Num.Integer.Integer instance Integer.AbsoluteDifference.AbsoluteDifference GHC.Num.Integer.Integer Integer.Positive.Unsafe.Positive module Integer.StrictlyIncrease -- | Class of numbers that are closed under addition with Positive class StrictlyIncrease a -- | Addition strictlyIncrease :: StrictlyIncrease a => Positive -> a -> a instance Integer.StrictlyIncrease.StrictlyIncrease GHC.Num.Integer.Integer instance Integer.StrictlyIncrease.StrictlyIncrease Integer.Signed.Signed instance Integer.StrictlyIncrease.StrictlyIncrease GHC.Num.Natural.Natural instance Integer.StrictlyIncrease.StrictlyIncrease Integer.Positive.Unsafe.Positive module Integer.Subtraction -- | Domain of a subtraction operation class Subtraction a subtractInteger :: Subtraction a => a -> a -> Integer subtractSigned :: Subtraction a => a -> a -> Signed -- | Codomain of a subtraction operation class Subtraction' b subtract :: (Subtraction' b, Subtraction a) => a -> a -> b instance Integer.Subtraction.Subtraction' GHC.Num.Integer.Integer instance Integer.Subtraction.Subtraction' Integer.Signed.Signed instance Integer.Subtraction.Subtraction GHC.Num.Integer.Integer instance Integer.Subtraction.Subtraction Integer.Signed.Signed instance Integer.Subtraction.Subtraction GHC.Num.Natural.Natural instance Integer.Subtraction.Subtraction Integer.Positive.Unsafe.Positive module Integer -- | 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 data () => Integer -- | Natural number -- -- Invariant: numbers <= 0xffffffffffffffff use the NS -- constructor data () => Natural data Positive data Signed Zero :: Signed NonZero :: Sign -> Positive -> Signed pattern Minus :: Positive -> Signed pattern Plus :: Positive -> Signed data Sign MinusSign :: Sign PlusSign :: Sign -- | Class of numbers are closed under addition with Natural class Increase a -- | Addition increase :: Increase a => Natural -> a -> a -- | Class of numbers that are closed under addition with Positive class StrictlyIncrease a -- | Addition strictlyIncrease :: StrictlyIncrease a => Positive -> a -> a -- | Domain of a subtraction operation class Subtraction a subtractInteger :: Subtraction a => a -> a -> Integer subtractSigned :: Subtraction a => a -> a -> Signed -- | Codomain of a subtraction operation class Subtraction' b subtract :: (Subtraction' b, Subtraction a) => a -> a -> b class AbsoluteDifference a b absoluteDifference :: AbsoluteDifference a b => a -> b -> Natural class IntegerNarrow a b narrow :: IntegerNarrow a b => a -> Maybe b class IntegerNarrow a b => IntegerConvert a b convert :: IntegerConvert a b => a -> b class (IntegerConvert a b, IntegerConvert b a) => IntegerEquiv a b -- | Partial conversion between Integral types via Integer -- --
-- yolo = fromInteger . toInteger --yolo :: (Integral a, Num b) => a -> b class ConvertWithFinite a toWord :: ConvertWithFinite a => a -> Maybe Word fromWord :: ConvertWithFinite a => Word -> Maybe a toInt :: ConvertWithFinite a => a -> Maybe Int fromInt :: ConvertWithFinite a => Int -> Maybe a class (Bounded b, Integral b) => Finite b toFinite :: (Finite b, ConvertWithFinite a) => a -> Maybe b fromFinite :: (Finite b, ConvertWithFinite a) => b -> Maybe a class BoundedBelow a minBound :: BoundedBelow a => a