Safe Haskell | None |
---|---|
Language | Haskell2010 |
NumHask.Algebra.Integral
Description
Integral classes
- class Semiring a => Integral a where
- class ToInteger a where
- class FromInteger a where
- fromIntegral :: (ToInteger a, FromInteger b) => a -> b
- even :: (Eq a, Integral a) => a -> Bool
- odd :: (Eq a, Integral a) => a -> Bool
- (^) :: (Ord b, Integral b, Multiplicative a) => a -> b -> a
- (^^) :: MultiplicativeGroup a => a -> Integer -> a
Documentation
class Semiring a => Integral a where Source #
Integral laws
b == zero || b * (a `div` b) + (a `mod` b) == a
Methods
div :: a -> a -> a infixl 7 Source #
mod :: a -> a -> a infixl 7 Source #
Instances
class ToInteger a where Source #
toInteger is kept separate from Integral to help with compatability issues.
Minimal complete definition
Instances
class FromInteger a where Source #
fromInteger is the most problematic of the Num
class operators. Particularly heinous, it is assumed that any number type can be constructed from an Integer, so that the broad classes of objects that are composed of multiple elements is avoided in haskell.
Minimal complete definition
Methods
fromInteger :: Integer -> a Source #
Instances
fromIntegral :: (ToInteger a, FromInteger b) => a -> b Source #
coercion of Integral
s
fromIntegral a == a
(^) :: (Ord b, Integral b, Multiplicative a) => a -> b -> a Source #
raise a number to a non-negative integral power
(^^) :: MultiplicativeGroup a => a -> Integer -> a Source #