numhask-0.1.4.0: A numeric prelude

Safe HaskellSafe
LanguageHaskell2010

NumHask.Algebra.Integral

Description

Integral classes

Synopsis

Documentation

class Ring a => Integral a where #

Integral laws

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

Minimal complete definition

divMod

Methods

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

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

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

Instances

Integral Int # 

Methods

div :: Int -> Int -> Int #

mod :: Int -> Int -> Int #

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

Integral Integer # 

class ToInteger a where #

toInteger is kept separate from Integral to help with compatability issues.

Minimal complete definition

toInteger

Methods

toInteger :: a -> Integer #

Instances

class FromInteger a where #

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

fromInteger

Methods

fromInteger :: Integer -> a #

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

coercion of Integrals

fromIntegral a == a