numhask-0.4.0: numeric classes

Safe HaskellNone
LanguageHaskell2010

NumHask.Data.Integral

Description

Integral classes

Synopsis

Documentation

class Distributive a => Integral a where Source #

Integral laws

b == zero || b * (a `div` b) + (a `mod` b) == a

Minimal complete definition

divMod, quotRem

Methods

div :: a -> a -> a infixl 7 Source #

mod :: a -> a -> a infixl 7 Source #

divMod :: a -> a -> (a, a) Source #

quot :: a -> a -> a Source #

rem :: a -> a -> a Source #

quotRem :: a -> a -> (a, a) Source #

Instances
Integral Int Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

div :: Int -> Int -> Int Source #

mod :: Int -> Int -> Int Source #

divMod :: Int -> Int -> (Int, Int) Source #

quot :: Int -> Int -> Int Source #

rem :: Int -> Int -> Int Source #

quotRem :: Int -> Int -> (Int, Int) Source #

Integral Int8 Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

div :: Int8 -> Int8 -> Int8 Source #

mod :: Int8 -> Int8 -> Int8 Source #

divMod :: Int8 -> Int8 -> (Int8, Int8) Source #

quot :: Int8 -> Int8 -> Int8 Source #

rem :: Int8 -> Int8 -> Int8 Source #

quotRem :: Int8 -> Int8 -> (Int8, Int8) Source #

Integral Int16 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Int32 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Int64 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Integer Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Natural Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Word Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

div :: Word -> Word -> Word Source #

mod :: Word -> Word -> Word Source #

divMod :: Word -> Word -> (Word, Word) Source #

quot :: Word -> Word -> Word Source #

rem :: Word -> Word -> Word Source #

quotRem :: Word -> Word -> (Word, Word) Source #

Integral Word8 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Word16 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Word32 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral Word64 Source # 
Instance details

Defined in NumHask.Data.Integral

Integral a => Integral (Pair a) Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

div :: Pair a -> Pair a -> Pair a Source #

mod :: Pair a -> Pair a -> Pair a Source #

divMod :: Pair a -> Pair a -> (Pair a, Pair a) Source #

quot :: Pair a -> Pair a -> Pair a Source #

rem :: Pair a -> Pair a -> Pair a Source #

quotRem :: Pair a -> Pair a -> (Pair a, Pair a) Source #

Integral a => Integral (Wrapped a) Source # 
Instance details

Defined in NumHask.Data.Wrapped

Methods

div :: Wrapped a -> Wrapped a -> Wrapped a Source #

mod :: Wrapped a -> Wrapped a -> Wrapped a Source #

divMod :: Wrapped a -> Wrapped a -> (Wrapped a, Wrapped a) Source #

quot :: Wrapped a -> Wrapped a -> Wrapped a Source #

rem :: Wrapped a -> Wrapped a -> Wrapped a Source #

quotRem :: Wrapped a -> Wrapped a -> (Wrapped a, Wrapped a) Source #

Integral a => Integral (Positive a) Source # 
Instance details

Defined in NumHask.Data.Positive

Integral b => Integral (a -> b) Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

div :: (a -> b) -> (a -> b) -> a -> b Source #

mod :: (a -> b) -> (a -> b) -> a -> b Source #

divMod :: (a -> b) -> (a -> b) -> (a -> b, a -> b) Source #

quot :: (a -> b) -> (a -> b) -> a -> b Source #

rem :: (a -> b) -> (a -> b) -> a -> b Source #

quotRem :: (a -> b) -> (a -> b) -> (a -> b, a -> b) Source #

class ToIntegral a b where Source #

toIntegral is kept separate from Integral to help with compatability issues. > toIntegral a == a

Minimal complete definition

Nothing

Methods

toIntegral :: a -> b Source #

toIntegral :: a ~ b => a -> b Source #

Instances
ToIntegral Int Int Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

toIntegral :: Int -> Int Source #

ToIntegral Int Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int8 Int8 Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

toIntegral :: Int8 -> Int8 Source #

ToIntegral Int8 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int16 Int16 Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int16 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int32 Int32 Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int32 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int64 Int64 Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Int64 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Integer Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Natural Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Natural Natural Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word Word Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

toIntegral :: Word -> Word Source #

ToIntegral Word8 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word8 Word8 Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word16 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word16 Word16 Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word32 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word32 Word32 Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word64 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

ToIntegral Word64 Word64 Source # 
Instance details

Defined in NumHask.Data.Integral

(ToIntegral a b, ExpField a) => ToIntegral (LogField a) b Source # 
Instance details

Defined in NumHask.Data.LogField

Methods

toIntegral :: LogField a -> b Source #

ToIntegral a b => ToIntegral (Wrapped a) b Source # 
Instance details

Defined in NumHask.Data.Wrapped

Methods

toIntegral :: Wrapped a -> b Source #

class FromIntegral a b where Source #

fromIntegral abstracts the codomain type, compared with the preludes Integral type. > fromIntegral_ a == a

fromIntegral is widely used as general coercion, hence the underscore for the operator.

Minimal complete definition

Nothing

Methods

fromIntegral_ :: b -> a Source #

fromIntegral_ :: a ~ b => b -> a Source #

Instances
FromIntegral Double Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Float Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int Int Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int8 Int8 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int8 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int16 Int16 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int16 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int32 Int32 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int32 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int64 Int64 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Int64 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Integer Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Natural Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Natural Natural Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word Word Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word8 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word8 Word8 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word16 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word16 Word16 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word32 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word32 Word32 Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word64 Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromIntegral Word64 Word64 Source # 
Instance details

Defined in NumHask.Data.Integral

(Additive a, FromIntegral a b) => FromIntegral (Complex a) b Source # 
Instance details

Defined in NumHask.Data.Complex

Methods

fromIntegral_ :: b -> Complex a Source #

(FromIntegral a b, Multiplicative a) => FromIntegral (Ratio a) b Source # 
Instance details

Defined in NumHask.Data.Rational

Methods

fromIntegral_ :: b -> Ratio a Source #

FromIntegral a b => FromIntegral (Pair a) b Source # 
Instance details

Defined in NumHask.Data.Pair

Methods

fromIntegral_ :: b -> Pair a Source #

(FromIntegral a b, ExpField a) => FromIntegral (LogField a) b Source # 
Instance details

Defined in NumHask.Data.LogField

Methods

fromIntegral_ :: b -> LogField a Source #

FromIntegral a b => FromIntegral (Wrapped a) b Source # 
Instance details

Defined in NumHask.Data.Wrapped

Methods

fromIntegral_ :: b -> Wrapped a Source #

FromIntegral a b => FromIntegral (c -> a) b Source # 
Instance details

Defined in NumHask.Data.Integral

Methods

fromIntegral_ :: b -> c -> a Source #

class FromInteger a where Source #

ghc defaulting rules and, it seems, -XExtendedDefaultRules do not permit multiple parameter typeclasses to be in the mix when types are resolved, hence the simpler `type FromInteger a = FromIntegral a Integer` does not suffice.

Minimal complete definition

Nothing

Instances
FromInteger Double Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Float Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Int Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Int8 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Int16 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Int32 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Int64 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Integer Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Natural Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Word Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Word8 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Word16 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Word32 Source # 
Instance details

Defined in NumHask.Data.Integral

FromInteger Word64 Source # 
Instance details

Defined in NumHask.Data.Integral

fromIntegral :: (FromInteger b, ToInteger a) => a -> b Source #

general coercion via Integer

even :: (Eq a, Integral a) => a -> Bool Source #

odd :: (Eq a, Integral a) => a -> Bool Source #

(^) :: (Ord b, Multiplicative a, Integral b) => a -> b -> a Source #

raise a number to a non-negative integral power

(^^) :: (Divisive a, Subtractive b, Integral b, Ord b) => a -> b -> a Source #