Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Integral classes
- class Ring a => Integral a where
- class ToInteger a where
- class FromInteger a where
- fromIntegral :: (ToInteger a, FromInteger b) => a -> b
Documentation
class Ring a => Integral a where Source #
Integral laws
b == zero || b * (a `div` b) + (a `mod` b) == a
class ToInteger a where Source #
toInteger is kept separate from Integral to help with compatability issues.
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.
fromInteger :: Integer -> a Source #
fromIntegral :: (ToInteger a, FromInteger b) => a -> b Source #
coercion of Integral
s
fromIntegral a == a